why select count(*) consumes wal logs

From: Ravi Krishna <srkrishna1(at)aol(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: why select count(*) consumes wal logs
Date: 2018-11-06 17:04:08
Message-ID: 653931906.1147337.1541523848244@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

PG 10.5

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?
I suspect vaccum is getting triggered, but this is a brand new table with no updates. So it should not.

Is there a SQL to peek into what PG is doing to write so much to WAL logs ?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ravi Krishna 2018-11-06 17:05:43 Re: why select count(*) consumes wal logs
Previous Message Adrian Klaver 2018-11-06 17:00:35 Re: Trouble Upgrading Postgres