From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Casey Lyon <casey(at)earthcars(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Thanks, naming conventions, and count() |
Date: | 2001-04-30 03:43:18 |
Message-ID: | 200104300343.f3U3hIB12175@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> It certainly works quickly for smaller tables, however the 21.7 million
> record table I ran this on takes a touch longer as shown here:
>
> database=# explain select count(*) from table;
> NOTICE: QUERY PLAN:
>
> Aggregate (cost=478056.20..478056.20 rows=1 width=0)
> -> Seq Scan on table (cost=0.00..423737.76 rows=21727376 width=0)
>
> EXPLAIN
>
> However I noted explain provides rows as part of it's data; from what
> I've seen this loses precision over time or with large data imports,
> though; at least until the table is vacuumed again.
I guess I was saying that an index scan could take longer because it has
to walk the btree. However it only has one column of the table, so it
may be faster. I never measured the two, but the heap access needed for
the index scan currently is a performance killer. Sequential is faster
than all those random heap lookups from the index.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-04-30 03:46:38 | Re: Thanks, naming conventions, and count() |
Previous Message | Serguei Mokhov | 2001-04-30 03:42:29 | Re: Thanks, naming conventions, and count() |