explain ? - Mailing list pgsql-general

From Patrick Welche
Subject explain ?
Date
Msg-id 20030418141905.E18170@quartz.newn.cam.ac.uk
Whole thread Raw
Responses Re: explain ?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I had a query which was dog slow. Explain showed the following:

                                                   QUERY PLAN
----------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=7878.67..7878.67 rows=1 width=24)
   ->  Nested Loop  (cost=0.00..7878.66 rows=1 width=24)
         ->  Seq Scan on trans  (cost=0.00..7875.63 rows=1 width=20)
               Filter: ((firsttimei = 2) AND (sourcepeeraddress = '192.168.0.1'::inet) AND (flowindex = 2))
         ->  Index Scan using stats_pkey on stats  (cost=0.00..3.02 rows=1 width=4)
               Index Cond: (stats.id = "outer".stats_id)
               Filter: (timeslice < 'Thu 13 Mar 00:00:00 2003'::timestamp without time zone)
(7 rows)


I created an index on firsttimei, vacuum full analysed, and explain showed me
*exactly* the same thing(!) The difference being that the query is now
lightning fast :-) So, what is explain actually telling me? The diffence
is the Filter: returns true|false more quickly because of the index?

Cheers,

Patrick


pgsql-general by date:

Previous
From: "Nigel J. Andrews"
Date:
Subject: Re: Storing sequence numbers for later use
Next
From: Tom Lane
Date:
Subject: Re: Problem with the use of Array and Loop