Re: does "select count(*) from mytable" always do a seq scan? - Mailing list pgsql-general

From Culley Harrelson
Subject Re: does "select count(*) from mytable" always do a seq scan?
Date
Msg-id [email protected]
Whole thread Raw
In response to Re: does "select count(*) from mytable" always do a seq  (Tino Wildenhain <[email protected]>)
Responses Re: does "select count(*) from mytable" always do a seq scan?
List pgsql-general
On Fri, 07 Jan 2005 16:17:16 +0100, Tino Wildenhain <[email protected]> wrote:
>
> How do you think an index would help if you do an unconditional
> count(*)?

I really don't know <grin>.  I don't know the inner workings of
database internals but I would guess that there would be some
optimized way of counting the nodes in an index tree that would be
faster than sequentially going through a table.... I suppose there is
no free lunch.

One row, two rows, three rows, four rows, five rows.... <snore>

culley

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Transaction size
Next
From: Tom Lane
Date:
Subject: Re: Transaction size