Re: [PERFORM] Optimization idea for long IN() lists

2014-08-08 Thread Maxim Boguk
On Sat, Aug 9, 2014 at 5:15 AM, Josh Berkus wrote: > Folks, > > So one thing we tell users who have chronically long IN() lists is that > they should create a temporary table and join against that instead. > Other than not having the code, is there a reason why PostgreSQL > shouldn't do something

[PERFORM] Optimization idea for long IN() lists

2014-08-08 Thread Josh Berkus
Folks, So one thing we tell users who have chronically long IN() lists is that they should create a temporary table and join against that instead. Other than not having the code, is there a reason why PostgreSQL shouldn't do something like this behind the scenes, automatically? -- Josh Berkus Po

Re: [PERFORM] two table join with order by on both tables attributes

2014-08-08 Thread Evgeniy Shishkin
> On 08 Aug 2014, at 16:29, Marti Raudsepp wrote: > > On Fri, Aug 8, 2014 at 4:05 AM, Evgeniy Shishkin wrote: >> select * from users join notifications on >> users.id=notifications.user_id ORDER BY users.priority desc >> ,notifications.priority desc limit 10; > > In my under

Re: [PERFORM] two table join with order by on both tables attributes

2014-08-08 Thread Marti Raudsepp
On Fri, Aug 8, 2014 at 4:05 AM, Evgeniy Shishkin wrote: > select * from users join notifications on users.id=notifications.user_id > ORDER BY users.priority desc ,notifications.priority desc limit 10; In my understanding, i need to have two indexes on users(priority desc, id)