Re: Large DB

Поиск
Список
Период
Сортировка
От Manfred Koizar
Тема Re: Large DB
Дата
Msg-id 7sqq60po4q8k0l7ere02sja1kkevb877cu@email.aon.at
обсуждение исходный текст
Ответ на Re: Large DB  (Manfred Koizar <mkoi-pg@aon.at>)
Ответы Re: Large DB  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Thu, 01 Apr 2004 12:22:58 +0200, I wrote:
>BTW, ANALYSE is basically a constant time operation.

On closer inspection, this is not the whole truth.  ANALY[SZ]E is a two
stage process:  First it collects a sample of rows, then these rows are
examined to produce various statistics.

The cost of the latter depends on the sample size, which itself depends
on the default or column-specific statistics target, and the number (and
types) of columns, so it *should* take more or less constant time.

The first step, however, (acquire_sample_rows() in analyze.c) has to
read more rows than finally end up in the sample.  It visits less than
O(nblocks) pages but certainly more than O(1).

A vague feeling tries to tell me that the number of page reads is
somehow related to the harmonic numbers 1 + 1/2 + 1/3 + ... + 1/n, which
grow like O(ln(n)).

I have an idea how this could be done with O(1) page reads.  If I'm able
to translate it into C, I'll send a patch ...

Servus
 Manfred

В списке pgsql-general по дате отправления:

Предыдущее
От: sferriol
Дата:
Сообщение: column oid ?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Optimization on UPDATEs and FOREIGN KEYs...