pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dror Matalon <dror@zapatec.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: count(*) slow on large tables
Date: Thu, 2 Oct 2003 12:15:47 -0700
Message-ID: <20031002191547.GZ87525@rlx11.zapatec.com> (raw)

Hi,

I have a somewhat large table, 3 million rows, 1 Gig on disk,  and growing. Doing a
count(*) takes around 40 seconds.

Looks like the count(*) fetches the table from disk and goes through it.
Made me wonder, why the optimizer doesn't just choose the smallest index
which in my case is around 60 Megs and goes through it, which it could
do in a fraction of the time.

Dror


-- 
Dror Matalon
Zapatec Inc 
1700 MLK Way
Berkeley, CA 94709
http://www.zapatec.com



view thread (30+ messages)  latest in thread

Message-ID: <20031002191547.GZ87525@rlx11.zapatec.com>
Permalink:  ../20031002191547.GZ87525@rlx11.zapatec.com/
Also on:    postgresql.org/message-id/20031002191547.GZ87525@rlx11.zapatec.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-performance@postgresql.org
  Cc: dror@zapatec.com
  Subject: Re: count(*) slow on large tables
  In-Reply-To: <20031002191547.GZ87525@rlx11.zapatec.com>
  References: <20031002191547.GZ87525@rlx11.zapatec.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