Re: [PERFORM] sunquery and estimated rows

2004-04-20 Thread Rod Taylor
On Sun, 2004-04-18 at 19:09, Tom Lane wrote: > Markus Bertheau <[EMAIL PROTECTED]> writes: > > , 17.04.2004, 01:45, Tom Lane : > >> The planner sees that as "where scope = " > >> and falls back to a default estimate. It won't simplify a sub-select > >> to a constant. (Some people consider that

Re: [PERFORM] sunquery and estimated rows

2004-04-19 Thread Litao Wu
Well, the example shown is simplified version. Now, let's see a little 'real' example (still simplified version): Table test is same as before: \d test Table "public.test" Column | Type | Modifiers -+--+--- id | inte

Re: [PERFORM] sunquery and estimated rows

2004-04-18 Thread Tom Lane
Rod Taylor <[EMAIL PROTECTED]> writes: >> It's the only way to prevent it from simplifying when you don't want it >> to. > I'm having a difficult time coming up with a circumstance where that is > beneficial except when stats are out of whack. Try trawling the archives --- I recall several cases

Re: [PERFORM] sunquery and estimated rows

2004-04-18 Thread Tom Lane
Markus Bertheau <[EMAIL PROTECTED]> writes: > В Сбт, 17.04.2004, в 01:45, Tom Lane пишет: >> The planner sees that as "where scope = " >> and falls back to a default estimate. It won't simplify a sub-select >> to a constant. (Some people consider that a feature ;-).) > Why? It's the only way to

Re: [PERFORM] sunquery and estimated rows

2004-04-18 Thread Markus Bertheau
Ð ÐÐÑ, 17.04.2004, Ð 01:45, Tom Lane ÐÐÑÐÑ: > The planner sees that as "where scope = " > and falls back to a default estimate. It won't simplify a sub-select > to a constant. (Some people consider that a feature ;-).) Why? Thanks -- Markus Bertheau <[EMAIL PROTECTED]>

Re: [PERFORM] sunquery and estimated rows

2004-04-16 Thread Tom Lane
Litao Wu <[EMAIL PROTECTED]> writes: > When I included a subquery, the estimated rows (1240) > is way too high as shown in the following example. > select * from test > where scope=(select 10); The planner sees that as "where scope = " and falls back to a default estimate. It won't simplify a s

[PERFORM] sunquery and estimated rows

2004-04-16 Thread Litao Wu
Hi, When I included a subquery, the estimated rows (1240) is way too high as shown in the following example. Can someone explain why? Because of this behavior, some of our queries use hash join instead of nested loop. Thanks, select version(); version