> 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
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)
> On 08 Aug 2014, at 03:43, 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)
>
>>> 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)
>> and notifications(user_id, priority desc)
>> then postgresql
Evgeniy Shishkin writes:
>> 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)
> and notifications(user_id, priority desc)
My question was about that you can not have fast execution of this kind of
query in postgresql.
With any runtime configuration you just swith from seq scan and hash join to
merge join, and then you have a sort node.
In my understanding, i need to have two indexes
on users(priority desc, id)
and
Evgeniy Shishkin wrote
> Hello,
>
> suppose you have two very simple tables with fk dependency, by which we
> join them
> and another attribute for sorting
>
> like this
> select * from users join notifications on users.id=notifications.user_id
> ORDER BY users.priority desc ,notifications.prior