Re: how fast index works?

Поиск
Список
Период
Сортировка
От Craig James
Тема Re: how fast index works?
Дата
Msg-id 4E6671DE.40506@emolecules.com
обсуждение исходный текст
Ответ на how fast index works?  ("Anibal David Acosta" <aa@devshock.com>)
Ответы Re: how fast index works?
Список pgsql-performance
On 9/6/11 11:31 AM, Anibal David Acosta wrote:

Hi everyone,

 

My question is, if I have a table with 500,000 rows, and a SELECT of one row is returned in 10 milliseconds, if the table has 6,000,000 of rows and everything is OK (statistics, vacuum etc)

can i suppose that elapsed time will be near to 10?


Theoretically the index is a B-tree with log(N) performance, so a larger table could be slower.  But in a real database, the entire subtree might fall together in one spot on the disk, so retrieving a record from a 500,000 record database could take the same time as a 6,000,000 record database.

On the other hand, if you do a lot of updates and don't have your autovacuum parameters set right, a 500,000 record index might get quite bloated and slow as it digs through several disk blocks to find one record.

There is no simple answer to your question.  In a well-maintained database, 6,000,000 records are not a problem.

Craig

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

Предыдущее
От: Richard Shaw
Дата:
Сообщение: Re: Rather large LA
Следующее
От: Alan Hodgson
Дата:
Сообщение: Re: Rather large LA