Re: Query optimization

Adrian Klaver <adrian.klaver@aklaver.com>

From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Durgamahesh Manne <maheshpostgres9@gmail.com>, pgsql-general <pgsql-general@lists.postgresql.org>
Date: 2025-03-13T19:17:23Z
Lists: pgsql-general
On 3/13/25 12:12, Durgamahesh Manne wrote:
> Hi Team
> 
> This query takes more time than usual for execution

Define usual.


> How to optimize it in best possible way

Can't be answered without, to start:

1) Postgres version.

2) Complete(including indexes) table schema.

3) Output of EXPLAIN ANALYZE of query.

4) In what client is this being run?


> 
> 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 ?)
> 
> Regards
> Durga Mahesh

-- 
Adrian Klaver
adrian.klaver@aklaver.com