From: | Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | explain ? |
Date: | 2003-04-18 13:19:05 |
Message-ID: | 20030418141905.E18170@quartz.newn.cam.ac.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-04-18 14:11:14 | Re: Problem with the use of Array and Loop |
Previous Message | Nigel J. Andrews | 2003-04-18 10:46:42 | Re: Storing sequence numbers for later use |