Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lzL03-0001Jm-0K for pgsql-general@arkaria.postgresql.org; Fri, 02 Jul 2021 15:22:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lzL01-0002Tv-Sx for pgsql-general@arkaria.postgresql.org; Fri, 02 Jul 2021 15:22:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lzL01-0002Tm-K8 for pgsql-general@lists.postgresql.org; Fri, 02 Jul 2021 15:22:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lzKzz-0008DV-AY for pgsql-general@lists.postgresql.org; Fri, 02 Jul 2021 15:22:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 162FMWR7819626; Fri, 2 Jul 2021 11:22:32 -0400 From: Tom Lane To: Igor Korot cc: Atul Kumar , pgsql-general Subject: In-reply-to: References: Comments: In-reply-to Igor Korot message dated "Fri, 02 Jul 2021 08:05:56 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <819624.1625239352.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 02 Jul 2021 11:22:32 -0400 Message-ID: <819625.1625239352@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Igor Korot writes: > On Fri, Jul 2, 2021, 5:24 AM Atul Kumar wrote: >> -> Seq Scan on sam_participant pp (cost=3D0.00..777393.87 rows=3D5611= 3 width=3D10) (actual time=3D0.277..10869.750 rows=3D2335154 loops=3D1) >> Filter: ((igroupid)::integer =3D (current_setting('env.groupid'::= text))::integer) >> I have already an index on the column igroupid of table >> sam_participant, but still it is doig seq scan, which is time >> consuming or is their something else is fishy. Where is that cast to integer coming from? That's likely causing the WHERE clause to not match your index. What's the actual type of the igroupid column? regards, tom lane