accessing primary key slower than accessing non primary key??? - Mailing list pgsql-novice

From HK
Subject accessing primary key slower than accessing non primary key???
Date
Msg-id Pine.LNX.4.33.0302131922060.5940-100000@mallard.midascomm.com
Whole thread Raw
Responses Re: accessing primary key slower than accessing non primary key???
Using unixODBC/psqlODBC -- Guidelines/Tips/Manaul?
List pgsql-novice
hi,
I am using postgresql 7.1.3 under RH linux 7.2
For sake of comparison of speeds i am doing a small experiment.
I am having a table with 20 columns (1 col with bigint as primary key)
the size of a record is 300 bytes.
On retrieving records with select query with where clause accessing a
primary key and a non primary key the times are as follows


          time in ms per query retrieval
        py key   non py key
        ------   -----------
2000            15.8     15.7
10000           71.2     70.7
25000           174      173.5
100000          4319     3417

As u see the non primary key retrieval is faster. AFAIK accessing primary
key should be faster. Can anybody throw light on why is this anamoly.

I use libpq with blocking execution of queries.
I ran this test with there being no other load in the system.

TIA.

--------
regards,
hari
      __
     / /    __  _  _  _  _ __  __         -o)
    / /__  / / / \\// //_// \\ \\/ /         /\\\\  Making things happen
   /____/ /_/ /_/\\/ /___/  /_/\\_\\        _\\_v-



pgsql-novice by date:

Previous
From: Alan Clucas
Date:
Subject: Cygwin and C triggers
Next
From: Tom Lane
Date:
Subject: Re: accessing primary key slower than accessing non primary key???