| От | Kevin Grittner |
|---|---|
| Тема | Re: SELECT LIMIT 1 VIEW Performance Issue |
| Дата | |
| Msg-id | s332af83.045@gwmta.wicourts.gov обсуждение исходный текст |
| Ответ на | SELECT LIMIT 1 VIEW Performance Issue (K C Lau <kclau60@netvigator.com>) |
| Список | pgsql-performance |
Have you tried the "best choice" pattern -- where you select the set of
candidate rows and then exclude those for which a better choice
exists within the set? I often get better results with this pattern than
with the alternatives. Transmuting your query to use this patter gives:
select PlayerID,AtDate from Player a where PlayerID='22220'
and not exists
(select * from Player b
where b.PlayerID = a.PlayerID and b.AtDate > a.AtDate);
>>> K C Lau <kclau60@netvigator.com> 09/21/05 11:21 PM >>>
select PlayerID,AtDate from Player a
where PlayerID='22220' and AtDate = (select b.AtDate from Player b
where b.PlayerID = a.PlayerID order by b.PlayerID desc, b.AtDate desc
LIMIT 1);
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера