Re: Optimize query for listing un-read messages

Поиск
Список
Период
Сортировка
От Andreas Joseph Krogh
Тема Re: Optimize query for listing un-read messages
Дата
Msg-id OfficeNetEmail.29.6f26451e1c5ffa11.145b977f133@prod2
обсуждение исходный текст
Ответ на Re: Optimize query for listing un-read messages  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Optimize query for listing un-read messages  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-performance
På torsdag 01. mai 2014 kl. 21:53:32, skrev Pavel Stehule <pavel.stehule@gmail.com>:
 
 
2014-05-01 21:39 GMT+02:00 Andreas Joseph Krogh <andreas@visena.com>:
På torsdag 01. mai 2014 kl. 21:30:39, skrev Pavel Stehule <pavel.stehule@gmail.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
 
Ah, that's what I was hoping to not having to do. In my system, messages arrive all the time and having to update a cache for all new messages for all users seems messy... Seems I could just as well create a message_property for all users when a new message arrives, so I can INNER JOIN it and get good performance. But that table will quickly grow *very* large...
 
--
Andreas Jospeh Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Вложения

В списке pgsql-performance по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Optimize query for listing un-read messages
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Optimize query for listing un-read messages