Re: Optimize query for listing un-read messages

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andreas Joseph Krogh <andreas(at)visena(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Optimize query for listing un-read messages
Date: 2014-05-01 19:53:32
Message-ID: CAFj8pRAOrokrj9JDG=u6uqxOfb26EsbN6zhuRq9zPQeSQ4k-og@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

2014-05-01 21:39 GMT+02:00 Andreas Joseph Krogh <andreas(at)visena(dot)com>:

> På torsdag 01. mai 2014 kl. 21:30:39, skrev Pavel Stehule <
> pavel(dot)stehule(at)gmail(dot)com>:
>
> Hello
> [snip]
>
> I had a perfect success on similar use case with descent ordered partial
> index
>
> http://www.postgresql.org/docs/9.3/interactive/sql-createindex.html
>
>
> I'm not getting good performance. Are you able to craft an example using
> my schema and partial index?
>

maybe some like

CREATE INDEX ON message_property (person_id, message_id) WHERE pr.is_read

When I am thinking about your schema, it is designed well, but it is not
index friendly, so for some fast access you should to hold a cache (table)
of unread messages.

Regards

Pavel

>
> Thanks.
>
> --
> *Andreas Jospeh Krogh*
> CTO / Partner - Visena AS
> Mobile: +47 909 56 963
> andreas(at)visena(dot)com
> www.visena.com
> <https://www.visena.com>
>
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Andreas Joseph Krogh 2014-05-01 20:30:09 Re: Optimize query for listing un-read messages
Previous Message Andreas Joseph Krogh 2014-05-01 19:39:36 Re: Optimize query for listing un-read messages