From: Tom Lane <tgl@sss.pgh.pa.us>
To: James DeMichele <James.DeMichele@redfin.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Simple select, but takes long time
Date: Fri, 11 Jan 2008 21:11:18 -0500
Message-ID: <29725.1200103878@sss.pgh.pa.us> (raw)
In-Reply-To: <082D8A131DF72A4D88C908A1AD3DEB2201AF140E@mail-1.rf.lan>
References: <082D8A131DF72A4D88C908A1AD3DEB2201AF140E@mail-1.rf.lan>
"James DeMichele" <James.DeMichele@redfin.com> writes:
> I am having a really hard time trying to figure out why my simple
> count(*) query is taking so long. I have a table with 1,296,070 rows in
> it. There are 2 different types of information that each row has that I
> care about:
Hmm, the EXPLAIN output works out to about 5 msec per row, which is not
too out of line for a lot of random-access disk fetches. I'm surprised
the planner bothered with an indexscan for this --- I'd bet a seqscan
might be faster, seeing you're having to read about 1% of the rows which
will likely touch most pages of the table anyway. Or a bitmap indexscan
might be even better. What do you get if you try the EXPLAIN ANALYZE
with enable_indexscan = off?
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, James.DeMichele@redfin.com
Subject: Re: Simple select, but takes long time
In-Reply-To: <29725.1200103878@sss.pgh.pa.us>
* 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