pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ravi Krishna <srkrishna1@aol.com>
To: pgsql-general@lists.postgresql.org
Subject: why select count(*) consumes wal logs
Date: Tue, 6 Nov 2018 17:04:08 +0000 (UTC)
Message-ID: <653931906.1147337.1541523848244@mail.yahoo.com> (raw)
References: <653931906.1147337.1541523848244.ref@mail.yahoo.com>

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 ?





view thread (15+ messages)  latest in thread

Message-ID: <653931906.1147337.1541523848244@mail.yahoo.com>
Permalink:  ../653931906.1147337.1541523848244@mail.yahoo.com/
Also on:    postgresql.org/message-id/653931906.1147337.1541523848244@mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: srkrishna1@aol.com
  Subject: Re: why select count(*) consumes wal logs
  In-Reply-To: <653931906.1147337.1541523848244@mail.yahoo.com>
  References: <653931906.1147337.1541523848244.ref@mail.yahoo.com> <653931906.1147337.1541523848244@mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox