Re: Are bitmap index scans slow to start?

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Are bitmap index scans slow to start?
Дата
Msg-id CAMkU=1yxVBQ5w1qa=wW06sOC5RPOHpfyORExV166ZCEEv9xuqA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Are bitmap index scans slow to start?  ("Carlo Stonebanks" <stonec.register@sympatico.ca>)
Список pgsql-performance
On Thu, Feb 28, 2013 at 12:13 PM, Carlo Stonebanks <stonec.register@sympatico.ca> wrote:

<<Could you use CLUSTER on the table after it had been closed off?  If appropriate, that should make the queries run much faster, as elated entries will be in the same or nearby blocks on disk.

>> 

 

Technically, yes. That would really help, but the issue is scheduling. Although the logs are closed off for writes, they aren’t closed off for reads, ref PG documentation: “When a table is being clustered, an ACCESS EXCLUSIVE lock is acquired on it. This prevents any other database operations (both reads and writes) from operating on the table until the CLUSTER is finished.”

 

Not ideal, but a lot better than doing nothing at all!

 
Since it is read only, you could make a copy of the table, cluster the copy (or just do the sorting while you make the copy), and then atomically swap the two tables by renaming them inside a single transaction.

The swap process will take an exclusive lock, but it will only last for a fraction of second rather than the duration of the clustering operation.

Cheers,

Jeff

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

Предыдущее
От: Niels Kristian Schjødt
Дата:
Сообщение: Re: New server setup
Следующее
От: "Benjamin Krajmalnik"
Дата:
Сообщение: Re: New server setup