aggregate on zero rows slow? - Mailing list pgsql-general

From Patrick Welche
Subject aggregate on zero rows slow?
Date
Msg-id 20020501215247.B876@quartz.newn.cam.ac.uk
Whole thread Raw
Responses Re: aggregate on zero rows slow?
Re: aggregate on zero rows slow?
List pgsql-general
I am trying to figure out why given the same query:

SELECT MAX(fromoctets),MAX(tooctets)
  FROM stats,trans
 WHERE stats.id=stats_id
   AND firsttimei=9224192
   AND sourcepeeraddress='xxx.yyy.zzz.38'
   AND flowindex=4701
   AND timeslice<'15:20:00 Wed  1 May 2002';

Aggregate  (cost=57.36..57.36 rows=1 width=16)
  ->  Nested Loop  (cost=0.00..57.36 rows=1 width=16)
        ->  Index Scan using firsttimei_idx on trans  (cost=0.00..54.33 rows=1 width=12)
        ->  Index Scan using stats_pkey on stats  (cost=0.00..3.02 rows=1 width=4)


the select appears to take much longer to complete if the WHERE clause
matches zero rows, than if it matches some rows.

Is this possible, or just chance?

Cheers,

Patrick

pgsql-general by date:

Previous
From: "Samuel J. Sutjiono"
Date:
Subject: Re: rowcount
Next
From: Anna Dorofiyenko
Date:
Subject: Re: rowcount