Re: Postgres refusing to use >1 core

Поиск
Список
Период
Сортировка
От Aren Cambre
Тема Re: Postgres refusing to use >1 core
Дата
Msg-id BANLkTikAPLv_oU7rFVODTyv887hSsGHJNQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Postgres refusing to use >1 core  (Eric McKeeth <eldin00@gmail.com>)
Ответы Re: Postgres refusing to use >1 core
Список pgsql-performance
This is a perfect example of a place where you could push some work out of the application and into the database. You can consolidate your 1 to 101 queries into a single query. If you use:

WHERE rte_nm='SH71' AND rm >= 206 AND rm <= 306 ORDER BY abs(rm - 256), rm - 256 DESC LIMIT 1

it will always return the same value as the first matching query from your list, and will never have to make more than one trip to the database. Your one trip might be slightly slower than any one of the single trips above, but it will certainly be much faster in the case where you have to hit any significant % of your 101 potential queries.

THANKS!! I've been obsessing so much about parallelism that I hadn't spent much time finding better queries.

Aren

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

Предыдущее
От: Aren Cambre
Дата:
Сообщение: Re: Postgres refusing to use >1 core
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Postgres refusing to use >1 core