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 1vh8E2-00A6Rl-0N for pgsql-performance@arkaria.postgresql.org; Sat, 17 Jan 2026 15:28:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vh8E1-008olC-0l for pgsql-performance@arkaria.postgresql.org; Sat, 17 Jan 2026 15:28:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vh8E0-008oky-1x for pgsql-performance@lists.postgresql.org; Sat, 17 Jan 2026 15:28:29 +0000 Received: from mx0b-0010f301.pphosted.com ([148.163.153.244]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vh8Dy-000wO7-1A for pgsql-performance@lists.postgresql.org; Sat, 17 Jan 2026 15:28:28 +0000 Received: from pps.filterd (m0102860.ppops.net [127.0.0.1]) by mx0b-0010f301.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60HCvqQn3609073 for ; Sat, 17 Jan 2026 09:28:25 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rice.edu; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=ricemail; bh=VemTDmgs0t3kxyqMjvUkXEwYg T7Bkoyv0JhdWvKFMws=; b=A3EXovbH5N17owqp2mTcZU5kk+pCbmj02yCj1Exv+ LEqRXVC1LL0R7N9j3Ye1cNfB16h51Lyyz1uYta+bC/8Nz4Ws6KzOlbVm8ktqrtUK qu3K92p2b6IQ/R5LG6luLN+F5voIstyFbZhIZitETUT9eMLLvR0RwuckKvF2qYax hYivV1b6oRzm6TWU+JplcP8xb5ZvQNBpy6FeNui0QmLZqcY6RGCcoCCgtz3gt3Ov L2QeEilsGHNHewAAyEUKvg01Qcxg4JKbQMdVVlAcpPg9aRPMLIozT8+/gppDZRJU FwV6n3ObxyRlR2BX6Dcy5ok5SioZxPSwlP/+l02SGb43g== Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) by mx0b-0010f301.pphosted.com (PPS) with ESMTPS id 4br8p3gc5g-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 17 Jan 2026 09:28:25 -0600 (CST) Received: by mail-oi1-f200.google.com with SMTP id 5614622812f47-45c72be7f0dso6502268b6e.3 for ; Sat, 17 Jan 2026 07:28:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768663705; x=1769268505; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VemTDmgs0t3kxyqMjvUkXEwYgT7Bkoyv0JhdWvKFMws=; b=OcUW250LRGzeFCl8HbbfJVgPuYPgHkPwyBKVlBiKY0zbCDFsioUy2MQ56km9/Sgdd7 OprxmCv1vaSsjUs8qt9B9lU/e0gXURbMMn7YfCwf6gPIf0elcZrqyR90jIFpk834SeY4 pj7QzJfhprz+4CZf5vy1TLngbcZEebwY1c9dWg9wHMNSzRLUm4djo/6y767Cn5uccL0K pPtatKEtw9SBwKKfXBt4RJu5qe07aL08i6cndr5hj5LMz7oeYDA3dhOmoitmAnanwhRF QpS/+6MJAsuSZ9zAyjegiua4+WOH5N7ABVGHL5TvZRrVTgd4o4fsHZjqIdOZ5oz5y3JH Ctag== X-Gm-Message-State: AOJu0YzXP9I4xM98COG5Rw7tZ1td8VsO/gTf9Kcg2THO5uG7yPlXE7v7 WIbiLBsdxQHFJQneXr0/HQ36TzScwI3HtH+8OQtghzMotMulfjUO76eJEFYr60MM2BgOmhjrpGs cN1BDNiZXXbcYHJSRwyVEjQlF80lB/dRPWJbbTUl6GflUSLCWPxIitvENzr6fXyqrFYgB2xEmyS zFFZlMMkfyiu3LTX2Yy1S8MdEJjxdvFA== X-Gm-Gg: AY/fxX77NNG7vWfBFw38iuG47lne+45JFH/H4O53Twh5SA4pvVhRLMP6wRzUJJddieE MKhrqnMiIsdJ7ceU0az2cnn4QoR45INv6Iecqmv8VVUKYbiveX8KL2gyVLtr+T7K9E1ax/Eu1dy 7JocsbYNLW5zSbVNHBedgdAYAEv9Fq6nQqcZidODymbjkHcAFZ5eJgKY2A1EiSU09gjMzeuMna5 jnpuEuCuJqsC+t96vBXkDMXpqQGVKHzraMxxO20rev39P+odNqZ7+MilIhBmc9/WhDrsu3JbKIT +KoszENJbW1QZto2xywDMbHySTDea0BSL1foxjYj75pRZ31B6IGvKl+xgd6GuLUzX83Bp0TjQb/ uxIUGW7BWJkJ6tP7tSkhjNdlOaLUfFfQaEoLg8w== X-Received: by 2002:a05:6808:318c:b0:455:8b5b:c763 with SMTP id 5614622812f47-45c9c1da2ccmr2914025b6e.67.1768663700422; Sat, 17 Jan 2026 07:28:20 -0800 (PST) X-Received: by 2002:a05:6808:318c:b0:455:8b5b:c763 with SMTP id 5614622812f47-45c9c1da2ccmr2914018b6e.67.1768663700066; Sat, 17 Jan 2026 07:28:20 -0800 (PST) Received: from customer.dllstxx1.pop.starlinkisp.net ([2605:59c8:449e:bc10:1a03:73ff:fecf:41f5]) by smtp.gmail.com with ESMTPSA id 5614622812f47-45c9decace9sm2839969b6e.4.2026.01.17.07.28.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jan 2026 07:28:19 -0800 (PST) Received: by customer.dllstxx1.pop.starlinkisp.net (sSMTP sendmail emulation); Sat, 17 Jan 2026 09:28:17 -0600 Date: Sat, 17 Jan 2026 09:28:17 -0600 From: Ken Marshall To: Lillian Berry Cc: pgsql-performance@lists.postgresql.org, infra@pluralkit.me Subject: Re: Slow queries on simple index Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Proofpoint-DLP: Gmail-Outbound X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-17_02,2026-01-15_02,2025-10-01_01 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Jan 17, 2026 at 02:58:01PM +0100, Lillian Berry wrote: > Logs on our PostgreSQL cluster show frequent slow reads on a simple query by unique index. > > This issue has been present for some years, and survived multiple server moves as well as PostgreSQL version upgrades. > Vacuuming or reindexing the table does not seem to help. > > Jan 17 13:38:13 database-node1-bd9aa148 pzqzs8zyvqrq1rq25z4drws8dhnbxa59-run-postgres[172632]: pluralkit-db-dataLOG: duration: 2322.842 ms execute : SELECT * FROM "members" WHERE "hid" = $1 > Jan 17 13:38:15 database-node1-bd9aa148 pzqzs8zyvqrq1rq25z4drws8dhnbxa59-run-postgres[157893]: pluralkit-db-dataLOG: duration: 2155.033 ms execute _auto8: SELECT * FROM "members" WHERE "hid" = $1 > Jan 17 13:38:16 database-node1-bd9aa148 pzqzs8zyvqrq1rq25z4drws8dhnbxa59-run-postgres[157826]: pluralkit-db-dataLOG: duration: 2164.851 ms execute _auto10: SELECT * FROM "members" WHERE "hid" = $1 > Jan 17 13:38:19 database-node1-bd9aa148 pzqzs8zyvqrq1rq25z4drws8dhnbxa59-run-postgres[171076]: pluralkit-db-dataLOG: duration: 2039.040 ms execute _auto3: SELECT * FROM "members" WHERE "hid" = $1 > Jan 17 13:38:20 database-node1-bd9aa148 pzqzs8zyvqrq1rq25z4drws8dhnbxa59-run-postgres[162682]: pluralkit-db-dataLOG: duration: 2189.700 ms execute _auto8: SELECT * FROM "members" WHERE "hid" = $1 > Jan 17 13:38:22 database-node1-bd9aa148 pzqzs8zyvqrq1rq25z4drws8dhnbxa59-run-postgres[159824]: pluralkit-db-dataLOG: duration: 2137.666 ms execute _auto10: SELECT * FROM "members" WHERE "hid" = $1 > > Parameter detail has been redacted for privacy. > > This is not reproducible on manual queries, whether using the same values or other random ones. > Hi, You may want to try auto_explain to try and catch the explain for one of these queries. You should also consider things like a checkpoint or other query that needs a lot of I/O or needs a lock on the affected table that would delay your query. I have had a system where the statistics changed the query to a sequential scan instead of an index lookup. Then when they stats were updated the query went back to the index. This just looks like normal multi-body problem fluctuations which can be identified by using much more instrumentation and logging at all layers: network, disk, db logs,... Good luck. Regards, Ken