Re: A Basic Question

From: Richard Huxton <dev(at)archonet(dot)com>
To: shyamperi(at)davlin(dot)co(dot)in, pgsql-performance(at)postgresql(dot)org
Subject: Re: A Basic Question
Date: 2003-10-03 10:10:25
Message-ID: 200310031110.25776.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Friday 03 October 2003 07:34, shyamperi(at)davlin(dot)co(dot)in wrote:
> 12:28p
> Dear All,
> This question is regarding the performance of queries in general.
> The performance of the queries wud varying depending on the no. Of tuples
> it is returning, and the sort of alogorithm that will be implemented or the
> retrieval. Now if the relation returns zero tuples.. (the seq, and the
> index scan is the best option) and if there are 1 or more then rest
> PG-supported scans will be the best. Now here is where I am having a bit of
> considerations. My relation works fast, when it returns more than on tuple.
> But get's slow when it returns zero tuple. Now how shud I got abt it.

If PG has to examine a lot of tuples to rule them out, then returning no rows
can take longer.

If you post EXPLAIN ANALYSE output for both queries, someone will be able to
explain why in your case.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Browne 2003-10-03 11:37:07 Re: count(*) slow on large tables
Previous Message Andriy Tkachuk 2003-10-03 07:02:03 Re: runtime of the same query in function differs on 2