From: Tom Lane <tgl@sss.pgh.pa.us>
To: HK <harikrishnan@midascomm.com>
Cc: pgsql-novice@postgresql.org
Subject: Re: accessing primary key slower than accessing non primary key???
Date: Thu, 13 Feb 2003 10:45:37 -0500
Message-ID: <13513.1045151137@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.33.0302131922060.5940-100000@mallard.midascomm.com>
References: <Pine.LNX.4.33.0302131922060.5940-100000@mallard.midascomm.com>
HK <harikrishnan@midascomm.com> writes:
> 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.
There's nothing magic about primary keys in Postgres; I'd expect the
results to come out the same.
The first three of these look like they're indeed the same, to within
measurement error. Not sure about the last one; perhaps you had some
effect of physical order in the table agreeing with the ordering of the
non-primary key?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: tgl@sss.pgh.pa.us, harikrishnan@midascomm.com, pgsql-novice@postgresql.org
Subject: Re: accessing primary key slower than accessing non primary key???
In-Reply-To: <13513.1045151137@sss.pgh.pa.us>
References: <Pine.LNX.4.33.0302131922060.5940-100000@mallard.midascomm.com> <13513.1045151137@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox