[PERFORM] PostgreSQL seems to create inefficient plans in simple conditional joins

2016-01-30 Thread Hedayat Vatankhah
Dear all, First of all, I should apologize if my email doesn't follow all the guidelines. I'm trying to do that though! If referencing to links is OK, you can find the full description of the issue at: http://dba.stackexchange.com/questions/127082/postgresql-seems-to-create-inefficient-plans-in-si

Re: [PERFORM] Hash join gets slower as work_mem increases?

2016-01-30 Thread Tomas Vondra
Hi, On 01/29/2016 04:17 PM, Albe Laurenz wrote: I have a query that runs *slower* if I increase work_mem. The execution plans are identical in both cases, except that a temp file is used when work_mem is smaller. The relevant lines of EXPLAIN ANALYZE output are: With work_mem='100MB': -> Has

Re: [PERFORM] PostgreSQL seems to create inefficient plans in simple conditional joins

2016-01-30 Thread David Rowley
On 31 January 2016 at 01:30, Hedayat Vatankhah wrote: > Personally, I expect both queries below to perform exactly the same: > > SELECT > t1.id, * > FROM > t1 > INNER JOIN > t2 ON t1.id = t2.id > where t1.id > -9223372036513411363; > > And: > > SELECT > t1.id, * > FROM > t1

Re: [PERFORM] PostgreSQL seems to create inefficient plans in simple conditional joins

2016-01-30 Thread Vitalii Tymchyshyn
It may be more for -hackers, but I often hear "this wont be used because of planning time increase". Now as I know we have statistics on real query time after few runs that is used to decide if plan should be switched. Can this statistics be used to apply advanced planning features for relatively l

Re: [PERFORM] PostgreSQL seems to create inefficient plans in simple conditional joins

2016-01-30 Thread David Rowley
On 31 January 2016 at 06:14, Vitalii Tymchyshyn wrote: > It may be more for -hackers, but I often hear "this wont be used because of > planning time increase". Now as I know we have statistics on real query time > after few runs that is used to decide if plan should be switched. > Can this statist

Re: [PERFORM] PostgreSQL seems to create inefficient plans in simple conditional joins

2016-01-30 Thread Vitalii Tymchyshyn
Well, as I can see it was just few phrases unless I miss something. May be it's worth to bring it to -hackers for a wider discussion? Best regards, Vitalii Tymchyshyn Сб, 30 січ. 2016 12:31 David Rowley пише: > On 31 January 2016 at 06:14, Vitalii Tymchyshyn wrote: > > It may be more for -hack

Re: [PERFORM] PostgreSQL seems to create inefficient plans in simple conditional joins

2016-01-30 Thread Hedayat Vatankhah
Hi, /*David Rowley*/ wrote on Sun, 31 Jan 2016 04:57:04 +1300: On 31 January 2016 at 01:30, Hedayat Vatankhah wrote: Personally, I expect both queries below to perform exactly the same: SELECT t1.id, * FROM t1 INNER JOIN t2 ON t1.id = t2.id where t1.id > -92233720365134113