Re: [External] Re: simple query on why a merge join plan got selected

2018-12-17 Thread Vijaykumar Jain
Thanks a lot Tom, as always :) We generally do not have so many duplicates in production, so maybe this is an edge case but I am happy with the explanation and the code reference for the analysis. I’ll also play with default statistic target to see what changes by increasing the value. On Sun, 16

Re: simple query on why a merge join plan got selected

2018-12-15 Thread Tom Lane
Vijaykumar Jain writes: > I was just playing with exploring joins and plans i came across this > create table t1(a int); > create table t2(a int); > insert into t1 select (x % 10) from generate_series(1, 10) x; > insert into t2 select (x % 100) from generate_series(1, 10) x; > ... > select

Re: simple query on why a merge join plan got selected

2018-12-15 Thread Ron
I'd run each query multiple times -- before and after disabling mergejoin -- to ensure that all the data is safely in RAM. On 12/15/2018 02:13 PM, Vijaykumar Jain wrote: Hey Guys, I was just playing with exploring joins and plans i came across this create table t1(a int); create table t2(a in

simple query on why a merge join plan got selected

2018-12-15 Thread Vijaykumar Jain
Hey Guys, I was just playing with exploring joins and plans i came across this create table t1(a int); create table t2(a int); insert into t1 select (x % 10) from generate_series(1, 10) x; insert into t2 select (x % 100) from generate_series(1, 10) x; pgtesting=> analyze t1; ANALYZE pgt