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.96) (envelope-from ) id 1vhNL4-00Dp84-0Y for pgsql-performance@arkaria.postgresql.org; Sun, 18 Jan 2026 07:36:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vhNL2-00A2X7-33 for pgsql-performance@arkaria.postgresql.org; Sun, 18 Jan 2026 07:36:45 +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.96) (envelope-from ) id 1vhC3J-009Q4C-21 for pgsql-performance@lists.postgresql.org; Sat, 17 Jan 2026 19:33:42 +0000 Received: from fhigh-b1-smtp.messagingengine.com ([202.12.124.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vhC3G-0012Uy-28 for pgsql-performance@lists.postgresql.org; Sat, 17 Jan 2026 19:33:41 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id C11947A0026; Sat, 17 Jan 2026 14:33:35 -0500 (EST) Received: from phl-imap-16 ([10.202.2.88]) by phl-compute-05.internal (MEProxy); Sat, 17 Jan 2026 14:33:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=star-ark.net; h= cc: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=fm2; t=1768678415; x=1768764815; bh=YbPF1ZC7yDK7yjr+4EFa6JLXmdf2SFqzKf6Z6rOdX+w=; b= WFvdV734F1RILvZ56qLTdtKVCBkKaMPr+9xyVyyjHWceERdTb8C/Qy9ObufZFoKg p9apV5p3JP5ZitzUwnO4F6wZXHElQ3ACqDZIr1pYLy+vHAOC/VEn3ii1o18z2SNs P4jP5SDlq4vlAEV3gfHkdCgyWAdFkJCoEf80A238exRb+NkVL2vO21GHRrgQT0qa O3CAUczmIfk5eYXIXSOUGa6K7+kwXNRzZaJo/ANR0m2gQKGWFEC6OUGDPlI+KQij 3d1NrrMqGcQhQ37FNcpuZ4EzL7wGunlPNRMtHnN5mRTE8GleTGXlYO7pZfYeC3sT FCZm524vSmJGUrf4C2/fCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm2; t=1768678415; x= 1768764815; bh=YbPF1ZC7yDK7yjr+4EFa6JLXmdf2SFqzKf6Z6rOdX+w=; b=l KE2S1hATUNb7aX1owgCNGeon4XgE/x/4Fk1uvLKVfVgaWMAAvL5j7EpZ9CrNL1Yk ky2mWJdrS2mM3XlxpJIQnN9XEidXfQqrlpGrd2HDhSweqjsJIaf7ccZX+X6Q18ai Wsy7HpjaAToH+RYsoGpdX2/bP7CQH4XTb45UbsNS37w/uBLZ815jvjEygdqykNEq Uoda4duqMA77OpJNRdBY2n8ntVNE7HPYOSSTGGR2t+uB3/Nt695lDfqNzsSxLKbM 9XMqY9Gjm1CQzSI99CZXrqYwVZYP65MNfE+EBeZDbG7vXOZLUsixq49JrqWe7h4a v2IJ5XoVVYkWohgAP3VqA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufedvieeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefoggffhffvvefkjghfufgtgfesthejre dtredttdenucfhrhhomhepfdfnihhllhhirghnuceuvghrrhihfdcuoehlihhllhhirghn sehsthgrrhdqrghrkhdrnhgvtheqnecuggftrfgrthhtvghrnhepgfdtgeegtdehfeefke fgfeffieekfedvtdeiudffvdevudekvdfhheekfefhfffhnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhhilhhlihgrnhesshhtrghrqdgrrh hkrdhnvghtpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphht thhopehpghhsqhhlqdhpvghrfhhorhhmrghntggvsehlihhsthhsrdhpohhsthhgrhgvsh hqlhdrohhrghdprhgtphhtthhopehinhhfrhgrsehplhhurhgrlhhkihhtrdhmvgdprhgt phhtthhopehkthhmsehrihgtvgdrvgguuh X-ME-Proxy: Feedback-ID: i8db94900:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id E254D2CC0083; Sat, 17 Jan 2026 14:33:34 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AuzG0eDhvpdc Date: Sat, 17 Jan 2026 20:33:32 +0100 From: "Lillian Berry" To: "Ken Marshall" Cc: pgsql-performance@lists.postgresql.org, infra@pluralkit.me Message-Id: In-Reply-To: References: Subject: Re: Slow queries on simple index Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, > You may want to try auto_explain to try and catch the explain for one of > these queries. I enabled auto_explain and it was very informative. LOG: duration: 2202.924 ms execute : SELECT * FROM "members" WHERE "hid" = $1 LOG: duration: 2202.918 ms plan: Query Text: SELECT * FROM "members" WHERE "hid" = $1 Query Parameters: $1 = '' Gather (cost=1000.00..907603.54 rows=67083 width=832) (actual time=1222.570..2202.893 rows=1.00 loops=1) Workers Planned: 2 Workers Launched: 2 Buffers: shared hit=816042 -> Parallel Seq Scan on members (cost=0.00..899895.24 rows=27951 width=832) (actual time=1719.931..1972.703 rows=0.33 loops=3) Filter: ((hid)::text = ''::text) Rows Removed by Filter: 4463227 Buffers: shared hit=816042 It's not using the indexes at all. Since the query is clearly the same as I attempted earlier, why would it not be using the index? This table gets reasonably frequent inserts, but the insert timestamps don't really match up with the slow queries (for instance, there can be a 30-second gap where no rows are inserted, but there is still a slow query every few seconds). The table gets infrequent deletes. Most if not all activity on this table is only updating single rows, or deleting based on the "system" foreign key column. There is a job that calculates the count of rows (select count(*) from members), but it only runs once a minute and takes 1-2 seconds. Kindly, Lillian