On Wed, Jan 02, 2008 at 09:29:24AM -0600, Abraham, Danny wrote:
> We are looking for a patch that will help us count using the indexes.
Is this for
SELECT count(*) FROM table;
SELECT count(1) FROM table WHERE. . .
The latter _will_ use an index, if the index is correct, the statistics are
right, and the index selectivity is worth the cost of reading the index.
The former will not use an index at all, because the answer depends on
visibility, and you can't know that without reading the table. If you're
counting how many rows are in the table (for, for instance, display
purposes), you probably need to do something else.
> Our product is about 20 times slower on Postgres compared to MS SQL
> Any ideas?
Not without the queries, the EXPLAIN ANALYZE plans, and some information
about the database.
In response to
pgsql-hackers by date
|Next:||From: Andrew Sullivan||Date: 2008-01-02 16:31:55|
|Subject: Re: Index performance|
|Previous:||From: Brian Modra||Date: 2008-01-02 15:53:35|
|Subject: Index performance|
pgsql-general by date
|Next:||From: Glyn Astill||Date: 2008-01-02 16:32:39|
|Subject: Table auditing / Pg/tcl help|
|Previous:||From: A. Kretschmer||Date: 2008-01-02 15:50:52|
|Subject: Re: Slow count(*)|