| From: | Shaun Thomas <sthomas(at)townnews(dot)com> | 
|---|---|
| To: | Sean Chittenden <sean-pgsql-general(at)chittenden(dot)org> | 
| Cc: | <pgsql-general(at)postgresql(dot)org> | 
| Subject: | Re: How Postgresql Compares For Query And Load Operations | 
| Date: | 2001-07-23 12:39:29 | 
| Message-ID: | Pine.LNX.4.33L2.0107230836171.1524-100000@hamster.lee.net | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Sat, 21 Jul 2001, Sean Chittenden wrote:
> > > I thought it was worth trying a different query as well :
> > >
> > > SELECT count(*) FROM fact0
> > >
> > > DB		Elapsed		Cpu
> > > Postgres	1m5s		32s
> > > Db2		23s		15s
> > > Oracle		37s		11s
>
> 	This may be an Oracle DBA myth, but I was told by my ORA DBA
> that it should be "SELECT count(1) FROM fact0" and not count(*).  For
> some reason it was thought that count(1) would run faster, but I can't
> confirm or deny this.  Does this make a difference in the benchmark?
> -sc
Actually, your oracle DBA was smoking crack. The real query is:
SELECT COUNT(rowid) FROM fact0;
RowID is a specially indexed field that Oracle uses to go DIRECTLY to a
record through the datafile->tablespace->cluster->row, hence circumvents
both indexes and the table itself.
-- 
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Shaun M. Thomas                INN Database Programmer              |
| Phone: (309) 743-0812          Fax  : (309) 743-0830                |
| Email: sthomas(at)townnews(dot)com    AIM  : trifthen                      |
| Web  : hamster.lee.net                                              |
|                                                                     |
|     "Most of our lives are about proving something, either to       |
|      ourselves or to someone else."                                 |
|                                           -- Anonymous              |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Marcelo Pereira | 2001-07-23 13:15:08 | Re: Language C - Console-based FrontEnd | 
| Previous Message | Daniel Freedman | 2001-07-23 12:27:58 | PostgreSQL at Federal Open Source Conference... |