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 1tsuxw-006kFu-IK for pgsql-general@arkaria.postgresql.org; Fri, 14 Mar 2025 02:40:04 +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 1tsuxv-00CNms-1B for pgsql-general@arkaria.postgresql.org; Fri, 14 Mar 2025 02:40:03 +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 1tsuxu-00CNmj-Kf for pgsql-general@lists.postgresql.org; Fri, 14 Mar 2025 02:40:02 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tsuxr-002l8E-0J for pgsql-general@lists.postgresql.org; Fri, 14 Mar 2025 02:40:02 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5e5c7d6b96fso2837756a12.3 for ; Thu, 13 Mar 2025 19:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741919999; x=1742524799; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Bc9SQY8c1giWTuX2sLEWE1gArHY9TGb+N5lctvpekak=; b=GB3rDnSnado9vYBiBFtX+DKJmg0wSqgtzMY2v4rNNdGeBtCFgM4/rbWC3fcfwWC8CA AGJeBkXUn0cIBgJH2iLxP+jKcbZPuP9gv25X3uAHHFOTwJ6vxE+ehMnz7FACD5ZZc1dy QJw7qGmde+Cn7CyB2jYoiokGwCEmIfPxy67ur9teoz3QwQaT1OlRopzTU7bBmld2FwpN urkpx11BYDvSKJjAP1OBdrvnOFaxKOKWzBHJ7OuI0g/Y+CaIk+ynPrA/MvNI9uunt+gL hQ1P4RoQp4vDCPKbg3fzLEna/P/amnU8nFfPyjeM8rqHlAhOPsqCAs5KV/F8tOp/oshS GE8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741919999; x=1742524799; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Bc9SQY8c1giWTuX2sLEWE1gArHY9TGb+N5lctvpekak=; b=TNcyZjmwZ9DayjFQSfvLbfXxMG0VGTANt/uPMaX4P6lIlXfbde27hsPk5SLzfad3e8 Ab3dbqpnoEuzzMYV698VTMOwIHXa22XcirkuX4OtasAVN5odcbqRzUzVVD1UxiwIawDd m1JGEAE/5P71YD1tQLof+/ZVOVVLOOTCssERAy1y4kFpklKUZwi7dv5vEyyb8V2t+AQO +DG/qvTdl8fG+CL/tl+2YlSDkdAP2QP923pP+1Rr3mjrVbZ9zdoDhwy9r6MlQF1Pe/Nw BCNIMQJmbkxFIoQhsngJsMfP6yeof8Ook1iOZhQDfuLCQ6Hw6CZTzx+akeYMb4907b7G iVdQ== X-Forwarded-Encrypted: i=1; AJvYcCXwkuvQg3ReaLcYe62lRVvZzTPx72DkaCSiooYjctXgYDNB2vOd4g4TN6bHrDS9Rh4UiXHJm1MYRfRbCUhQ@lists.postgresql.org X-Gm-Message-State: AOJu0YySise01VJ6y6O55x5G8kGEpDuHuYqcIQ9qokmPN9CrsZDiikj7 YfmHs32afxgYS27anUctttqfl7KcejUQTf/o8vqPqMxP0yBrDRGVCx2m9bDTh+/USNDwjoBGeqm uuzBOe/AOcXBuwnsMe+02f7fdArU= X-Gm-Gg: ASbGncu0tRWyI0o5sndS6ccYtP8Pq9Q2HTrIWyWSqpTO4F5aP/RmKxQ3NRVTG7uGc6K 3JJxgnusBJZK67Iv7i05qYD2ozm/vKFPHWNV79oJHqjS08SrF6mJ7gBI0eCNiQAF/aZEuGLxFf3 cCwSr1K5uZGofaNF7bZMMmLIoOjg== X-Google-Smtp-Source: AGHT+IFdWa2Bn6E0pg61fpwsSkgHpOHWN+uwsQ+rWfLtODsX184Db4amURTZYfguyw0wPbwpevaSuPCoMzLIYIV9ojc= X-Received: by 2002:a17:906:dc91:b0:ac2:c424:c316 with SMTP id a640c23a62f3a-ac330550f0dmr69047666b.57.1741919998905; Thu, 13 Mar 2025 19:39:58 -0700 (PDT) MIME-Version: 1.0 References: <77CFD347-1A36-4A78-8D95-21569977C0A5@gmail.com> In-Reply-To: <77CFD347-1A36-4A78-8D95-21569977C0A5@gmail.com> From: Durgamahesh Manne Date: Fri, 14 Mar 2025 08:09:46 +0530 X-Gm-Features: AQ5f1JpUVSTtTiUfGbNnrbIBCswPoW2rgJ2zBl-ymyny-xnn4Y9ecgtjLBWwiIU Message-ID: Subject: Re: Query optimization To: Rob Sargent Cc: Adrian Klaver , pgsql-general , laurenz.albe@cybertec.at Content-Type: multipart/alternative; boundary="000000000000c3149d0630445a87" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c3149d0630445a87 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 14 Mar, 2025, 08:04 Rob Sargent, wrote: > > > > 3) Output of EXPLAIN ANALYZE of query. > > Result (cost=3D2.80..2.83 rows=3D1 width=3D1) (actual time=3D0.030..0.0= 30 rows=3D1 > loops=3D1) > InitPlan 1 (returns $0) > -> Index Only Scan using idx_cachekeys on cachekeys > (cost=3D0.55..2.80 rows=3D1 width=3D0) (actual time=3D0.029..0.029 rows= =3D1 loops=3D1) > Index Cond: ((cachetype =3D 'BoMatrix'::text) AND (trsid =3D > 'daznbetuk'::text) AND (brandid =3D 'daznbet'::text) AND (sportid =3D > 'BOX'::text) AND (competitionid =3D 'U-1998'::text) AND (eventid =3D > 'U-523596'::text)) > Heap Fetches: 0 > Planning Time: 0.221 ms > Execution Time: 0.046 ms > > > > And is the explain analyze output if from your original query: > "SELECT EXISTS (SELECT Key FROM CACHEKEYS WHERE CacheType =3D $1 AND TrsI= d > =3D $2 AND BrandId =3D $3 AND SportId =3D $4 AND CompetitionId =3D $5 AND= EventId =3D > $6 AND MarketId =3D $7 LIMIT ?)=E2=80=9D > > Has there been any significant addition of rows recently? i.e. are the > statistics up-to-date for that table? > Hi Gave you plan with out limit . Stats up to date insert .....on conflict do nothing runs some times Regards Durga Mahesh > > > --000000000000c3149d0630445a87 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Fri, 14 Mar, 2025, 08:04 Rob = Sargent, <robjsargent@gmail.com= > wrote:



3= ) Output of EXPLAIN ANALYZE of query.

<= /div>
=C2=A0Result =C2=A0(cost=3D2.80..2.83 rows= =3D1 width=3D1) (actual time=3D0.030..0.030 rows=3D1 loops=3D1)
=C2=A0 = =C2=A0InitPlan 1 (returns $0)
=C2=A0 =C2=A0 =C2=A0-> =C2=A0Index Only= Scan using idx_cachekeys on cachekeys =C2=A0(cost=3D0.55..2.80 rows=3D1 wi= dth=3D0) (actual time=3D0.029..0.029 rows=3D1 loops=3D1)
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0Index Cond: ((cachetype =3D 'BoMatrix'::= text) AND (trsid =3D 'daznbetuk'::text) AND (brandid =3D 'daznb= et'::text) AND (sportid =3D 'BOX'::text) AND (competitionid =3D= 'U-1998'::text) AND (eventid =3D 'U-523596'::text))
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Heap Fetches: 0
=C2=A0Planning Tim= e: 0.221 ms
=C2=A0Execution Time: 0.046 ms



And is the explain analyze output if= from your original query:
"SELECT EXISTS (SELECT Key FROM CACHEKEYS WHERE CacheType =3D $1 = AND TrsId =3D $2 AND BrandId =3D $3 AND SportId =3D $4 AND CompetitionId = =3D $5 AND EventId =3D $6 AND MarketId =3D $7 LIMIT ?)=E2=80=9D

Has there been any significant addition of rows recently? i.e. are the sta= tistics up-to-date for that table?
Hi

Gave you plan = with out limit . Stats up to date insert .....on conflict do nothing runs s= ome times=C2=A0

Regards= =C2=A0
Durga Mahesh


--000000000000c3149d0630445a87--