Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tso3h-005jMn-SN for pgsql-general@arkaria.postgresql.org; Thu, 13 Mar 2025 19:17:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tso3g-003YqS-6l for pgsql-general@arkaria.postgresql.org; Thu, 13 Mar 2025 19:17:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tso3f-003Yq6-3P for pgsql-general@lists.postgresql.org; Thu, 13 Mar 2025 19:17:31 +0000 Received: from fhigh-a6-smtp.messagingengine.com ([103.168.172.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tso3a-002hYZ-1a for pgsql-general@lists.postgresql.org; Thu, 13 Mar 2025 19:17:30 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id 8ECFC1140143; Thu, 13 Mar 2025 15:17:24 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Thu, 13 Mar 2025 15:17:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1741893444; x=1741979844; bh=sm/zyhUJ1OPH9ggRTZdV54gq1l+eZWyoP462fqlmB5c=; b= QGcPVfuyzZyxkcddVYbKW11aNS6AlN0PsSq+CkLb4CNarSR8MzT93sWLQ+p60XTu 6G4DpKEQbKwvN1xOaFaBPKhwecQNHNu8K/mm1HDDiG1XFqTk0dnYkS2908duhVB2 SfNw4QSUXncJ9U9vyG/XR9tHGOefM4QSXg8K4rzNyDLeWZ7twVwstGui0i/gil7e VwT7VDvrpuRKqc0Inqs7D/0pIA905otkRhqmuhdXzpkOFCJ9ZocS5Hx1YlWlofbK AHvKMYfrIG/2aGMq7EenMRQ2gawOXZ5yJCKmkMocB/8fMVb89YuhL06h0pygiESS hm2pObdAe60Pph/5nrdqSQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1741893444; x=1741979844; bh=s m/zyhUJ1OPH9ggRTZdV54gq1l+eZWyoP462fqlmB5c=; b=W8SrIk0IiDDolterA LFT1W+LSS3hNRSwhpKHPiMUxyseJ/Y4+rY9JOOJBMswdtWHKdHv72SAU5NJ35xWj gJwKHz463zx3wMaN5/MS8rXfMpNLENqA5+BLw3WBY6QiIhOzGyHfX+2MXU4xDdhZ zLRVdVmRI4+vXjfocC3quMYeOpUv1X5bn1NzTn1sar8ffkUOxwKZdTtbT84YdwoU lH1gwEBoX5XImvrllVLa66dNPwxJ4Hfll9+uNSBBomlkIyJGMgL5yT+kOimadAML 3OGtvryAtY3/JVTV0y1hhPNUOO7HtZ9gpcOXIFI6SABsTdx4+vz1QfYNT2Uc9F5T ocM0w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvdekjeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkff ggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghv vghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrf grthhtvghrnhepffelgeeifefgveduhedthfekuedtffejveegffegjeevtdehgfduieet feehjeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhdpnhgspghrtghpthht ohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhgrhhgvshhhphhoshhtgh hrvghsleesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghl sehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 Mar 2025 15:17:23 -0400 (EDT) Message-ID: Date: Thu, 13 Mar 2025 12:17:23 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Query optimization To: Durgamahesh Manne , pgsql-general References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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