[GENERAL] Merge join vs merge semi join against primary key

2015-10-09 Thread Sean Rhea
Hello, I'm seeing some inexplicable (to me) behavior in PostgreSQL 9.2. I checked the archives, but I still can't explain it. Apologies if I missed something. 1. When I join two tables with "WHERE id IN (...)" versus with an explicit join, and the join column for the inner table is a primary key,

Re: [GENERAL] Merge join vs merge semi join against primary key

2015-10-09 Thread Sean Rhea
It does the merge (not-semi) join: production=> explain analyze SELECT ac.* FROM balances ac JOIN customers o ON (o.id = ac.customer_id AND o.group_id = 45); QUERY PLAN --

Re: [GENERAL] Merge join vs merge semi join against primary key

2015-10-13 Thread Sean Rhea
duction=> select count(*) from customers; count 476645 (1 row) Is it possible for explain analyze to somehow produce bad stats? I can't figure out where that 212699113 number is coming from at all. Sean On Mon, Oct 12, 2015 at 5:43 PM, David Rowley wrote: > On 10 Octobe

Re: [GENERAL] Merge join vs merge semi join against primary key

2015-10-13 Thread Sean Rhea
Sean On Tue, Oct 13, 2015 at 11:20 AM, Tom Lane wrote: > Sean Rhea writes: > > No, the customers table is not 100% the same. This is a live production > > system, so the data is (unfortunately) changing under us a bit here. That > > said, there are still some strange thi