'explain analyze' output is below.  I have done analyze recently, and
am using pg 7.4.2 on SuSE 9.1.  I'd be curious to know how to "a
nestloop indexscan" to try it out.


mydb=> explain analyze select * from line_items t, sales_tickets s
where writtenDate >= '12/01/2002' and writtenDate <= '12/31/2002' and
t.ticketid = s.ticketId and s.storeId = 1;
                                                                     QUERY PLAN
 Hash Join  (cost=93865.46..114054.74 rows=19898 width=28) (actual
time=25419.088..32140.217 rows=23914 loops=1)
   Hash Cond: ("outer".ticketid = "inner".ticketid)
   ->  Index Scan using line_items_written on line_items t 
(cost=0.00..3823.11 rows=158757 width=16) (actual
time=100.621..3354.818 rows=169770 loops=1)
         Index Cond: ((writtendate >= '2002-12-01'::date) AND
(writtendate <= '2002-12-31'::date))
   ->  Hash  (cost=89543.50..89543.50 rows=626783 width=12) (actual
time=22844.146..22844.146 rows=0 loops=1)
         ->  Seq Scan on sales_tickets s  (cost=0.00..89543.50
rows=626783 width=12) (actual time=38.017..19387.447 rows=713846
               Filter: (storeid = 1)
 Total runtime: 32164.948 ms
(8 rows)

On Fri, 7 Jan 2005 11:35:11 -0800, Josh Berkus <josh@agliodbs.com> wrote:
> Can you run EXPLAIN ANALYZE instead of just EXPLAIN?  That will show you the
> discrepancy between estimated and actual costs, and probably show you what
> needs fixing.

Also, Tom Lane wrote:
> Could we see EXPLAIN ANALYZE, not just EXPLAIN, results?
> Also, have you ANALYZEd lately?  If the estimated row counts are at all
> accurate, I doubt that forcing a nestloop indexscan would improve the
> situation.
> Also, what PG version is this?

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to