Re: why select count(*) consumes wal logs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: why select count(*) consumes wal logs
Дата
Msg-id 26567.1541526011@sss.pgh.pa.us
обсуждение исходный текст
Ответ на why select count(*) consumes wal logs  (Ravi Krishna <srkrishna1@aol.com>)
Ответы Re: why select count(*) consumes wal logs  (Michael Nolan <htfoot@gmail.com>)
Re: why select count(*) consumes wal logs  (Bruno Lavoie <bl@brunol.com>)
Список pgsql-general
Ravi Krishna <srkrishna1@aol.com> writes:
> I loaded 133 million rows to a wide table (more than 100 cols) via COPY. The table has
> no index at this time. Since I am the only user I don't see any other activity.
> Now when I run select count(*) on the table where I just loaded data, it runs for ever,
> more than 10min and still running. Intrigued, I checked locks and saw nothing.  Then I noticed something
> strange.  When select count(*) runs, PG is writing to wal_logs, and that too a large amount. Why?

That represents setting the yes-this-row-is-committed hint bits on the
newly loaded rows.  The first access to any such row will set that bit,
whether it's a select or a VACUUM or whatever.

            regards, tom lane


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

Предыдущее
От: "Kumar, Virendra"
Дата:
Сообщение: RE: why select count(*) consumes wal logs
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Trouble Upgrading Postgres