Re: Query optimization

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Query optimization
Дата
Msg-id 5b5ba309ccb2a32953f01adc2dcf96260bc9b6c8.camel@cybertec.at
обсуждение исходный текст
Ответ на Query optimization  (Durgamahesh Manne <maheshpostgres9@gmail.com>)
Список pgsql-general
On Fri, 2025-03-14 at 00:42 +0530, Durgamahesh Manne wrote:
> This query takes more time than usual for execution 
>
> How to optimize it in best possible way
>
> Columns used in this query >> composite index eventhough not running optimally 
> SELECT EXISTS (SELECT Key FROM CACHEKEYS WHERE CacheType = $1 AND TrsId = $2 AND
>                BrandId = $3 AND SportId = $4 AND CompetitionId = $5 AND
>                EventId = $6 AND MarketId = $7 LIMIT ?)

"The best possible way" is hard to say, because an index will have negative
effects on data modification statements.

But for the fastest execution of the query, simply create an index on all the
columns that occur in the WHERE clause.  The order doesn't matter.

And remove that useless LIMIT clause.

Yours,
Laurenz Albe



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