Re: [SQL] Wrong query plan when using a left outer join

2012-01-17 Thread Rosser Schwarz
2012/1/17 Filip Rembiałkowski : > postgres will still try to choose best execution plan. seq scan may simply be > faster here. breaking point is somewhere near 50% selectivity. The tipping point is usually far lower than that; in fact, it's more often around 10%. Random IO is *very* expensive, a

Re: [SQL] Wrong query plan when using a left outer join

2012-01-17 Thread Feike Steenbergen
oops, but ofcourse, a natural view will not give the correct answer, back to the drawing board ... On Tue, Jan 17, 2012 at 19:53, Feike Steenbergen wrote: >> BTW, add a foreign key and index on handhistory_plain.hand_id (unless> you >> have it already). > It's there already: > > feiketracker=# \

Re: [SQL] Wrong query plan when using a left outer join

2012-01-17 Thread Feike Steenbergen
> BTW, add a foreign key and index on handhistory_plain.hand_id (unless> you > have it already). It's there already: feiketracker=# \d+ handhistory_plain; Table "stage.handhistory_plain" Column | Type | Modifiers | Storage | Description -+-+---+--

Re: [SQL] Wrong query plan when using a left outer join

2012-01-17 Thread Filip Rembiałkowski
On Tue, Jan 17, 2012 at 7:54 AM, Feike Steenbergen wrote: > I have the following setup: > > A table called hand: > > >                                        Table "stage.hand_meta" >    Column     |           Type           | > Modifiers > ---+--+--

[SQL] Wrong query plan when using a left outer join

2012-01-16 Thread Feike Steenbergen
I have the following setup: A table called hand: Table "stage.hand_meta" Column | Type | Modifiers ---+--+- hand_id | integer