Re: Nested Loop WAS: VACUUM ANALYZE makes things

From: "Ian Harding" <ianh(at)tpchd(dot)org>
To: <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Nested Loop WAS: VACUUM ANALYZE makes things
Date: 2002-04-12 21:57:22
Message-ID: scb6f646.034@mail.tpchd.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Another case of blockhead programmer. I must have been smoking something when I wrote that piece of junk. I collapsed it into a single query with sum(CASE WHEN DAYNUMBER = X THEN HOURS ELSE NULL) for the hours and it works like clockwork.

Sorry about the noise.

Ian A. Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
(253) 798-3549
mailto: iharding(at)tpchd(dot)org

>>> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 04/12/02 02:12PM >>>
"Ian Harding" <ianh(at)tpchd(dot)org> writes:
> Doh! I set enable_seqscan = off and things are snappy again.
> Same problem though, how can I fix the query so the optimizer comes to the same conclusion?

I notice that in the "before" state, the planner thinks there will be
some thousands of rows coming out of each join, but in the "after"
state only one row. Which of these is more correct? (If you are
running 7.2, it'd be helpful to show EXPLAIN ANALYZE not just
EXPLAIN results for each case.)

regards, tom lane

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

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-04-12 22:13:42 Re: Nested Loop WAS: VACUUM ANALYZE makes things worse!
Previous Message Nick Fankhauser 2002-04-12 21:56:03 A *short* planner question