Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gK4px-0003dB-Kk for pgsql-general@arkaria.postgresql.org; Tue, 06 Nov 2018 17:08:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gK4pw-0002FI-4U for pgsql-general@arkaria.postgresql.org; Tue, 06 Nov 2018 17:08:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gK4pv-0002EV-DB for pgsql-general@lists.postgresql.org; Tue, 06 Nov 2018 17:08:19 +0000 Received: from sonic317-54.consmr.mail.bf2.yahoo.com ([74.6.129.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gK4pn-0006b9-DL for pgsql-general@lists.postgresql.org; Tue, 06 Nov 2018 17:08:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1541524089; bh=JTYl8QGMuUq8du5E5GkoTS8SZBpxlPauEzvkPU4geh8=; h=Date:From:To:Subject:References:From:Subject; b=b3NsIWdVUOCTptSXZy1L2k3XX+amOeEQzzOpkHNj3XM9QrjK3oTHxNsX9H0YN2kV4C4ThLpb9Yf6tQYhTI/3jfwyEhwjyD1nsCrzM+K1Fk7DPduWxatCX78Q+PhZLXwWdTOhWdIqBnhgamUKP8pgJUCe5FTw997NTBF6FUXeRlIfXRbZC7v6zXAVQWYWbivLp6/PBAc79JV5aEgv/e+ppL4DQjGheYVJqY38ZXh0KMYplkkWp+ri4cRIWGzu/saUoH1/ObgxS3X4V+qWnM9CEnr84jdTb17qiA73kO3p7sa8EiR0687rkds9RUd+wN7lmybyhcuHDwFMXNESgq2Ttg== X-YMail-OSG: N_6BpMEVRDvd.miR6A7lED5GPdAEx7ojsA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.bf2.yahoo.com with HTTP; Tue, 6 Nov 2018 17:08:09 +0000 Date: Tue, 6 Nov 2018 17:04:08 +0000 (UTC) From: Ravi Krishna To: pgsql-general@lists.postgresql.org Message-ID: <653931906.1147337.1541523848244@mail.yahoo.com> Subject: why select count(*) consumes wal logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit References: <653931906.1147337.1541523848244.ref@mail.yahoo.com> X-Mailer: WebService/1.1.12711 aolwebmail Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 Content-Length: 652 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 ?