Re: How Postgresql Compares For Query And Load Operations - Mailing list pgsql-general

From Shaun Thomas
Subject Re: How Postgresql Compares For Query And Load Operations
Date
Msg-id Pine.LNX.4.33L2.0107230836171.1524-100000@hamster.lee.net
Whole thread Raw
In response to Re: How Postgresql Compares For Query And Load Operations  (Sean Chittenden <sean-pgsql-general@chittenden.org>)
List 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@townnews.com    AIM  : trifthen                      |
| Web  : hamster.lee.net                                              |
|                                                                     |
|     "Most of our lives are about proving something, either to       |
|      ourselves or to someone else."                                 |
|                                           -- Anonymous              |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+



pgsql-general by date:

Previous
From: Marcelo Pereira
Date:
Subject: Re: Language C - Console-based FrontEnd
Next
From: Nils Zonneveld
Date:
Subject: Re: ODBC driver for Mac?