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 1vh7bQ-009wkH-0v for pgsql-performance@arkaria.postgresql.org; Sat, 17 Jan 2026 14:48:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vh7aO-008SpC-37 for pgsql-performance@arkaria.postgresql.org; Sat, 17 Jan 2026 14:47:33 +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 1vh6oc-008Iw0-1l for pgsql-performance@lists.postgresql.org; Sat, 17 Jan 2026 13:58:11 +0000 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vh6oZ-000zwv-2T for pgsql-performance@lists.postgresql.org; Sat, 17 Jan 2026 13:58:10 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id DB0621400496; Sat, 17 Jan 2026 08:58:04 -0500 (EST) Received: from phl-imap-16 ([10.202.2.88]) by phl-compute-05.internal (MEProxy); Sat, 17 Jan 2026 08:58:04 -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:message-id:mime-version:reply-to :subject:subject:to:to; s=fm2; t=1768658284; x=1768744684; bh=8l up16KOn4GzI2cpz6mLiKt8cVfxyUGaLg+tSGPF4yY=; b=cgao+X5Mu6Tz2tpX4o WgzFPT9Iq/KTHHfEX/mDiBAyHnhFZW9knN5nbzhjUKJ+2Cr20+IvT2WrMjZtt9VK peJQ7X6/+lny6bWvnsSOrF+ftAH3RvxLRCyjl+Z6RTMoqASnGQoVzJL6VWL4CHft FBcZnMw3cAa1FlvjB7IL42jV274oxDWkf7diLYYaCLbr7ewD4yBkieha0T5Xkrra 3QrRCtNfDZGp8CY8PNKiC6WLHfb6EDw35dkvMF66oXWxJwqS9ZPQLpBL2G8Im08t PhIxS8l+1HMLk0+qyoQaXlO8OKu96PQCdyCnV6VLd9icn6hArivmQzX5lcXs5C7C irRA== 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:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1768658284; x=1768744684; bh=8lup16KOn4GzI2cpz6mLiKt8cVfx yUGaLg+tSGPF4yY=; b=PjAx8nS4wmPgOzTDGL5rHjXqzhcY9s5Aszms497xn1kO +sI4zqglFSNBQs9tPer65zQu64iY0eeouHaBVLshJBiNt2MwoBb4Uj1GAbUuIZRm UEf0er+2x1FIFyUQtXwXMvFZ/+OjSkTizHEOeiqO0KbRpeiOLMPCMyOf2Kc4XMTV 9GwQ1EAGlHo53nznkvVFc+IGGm8JNC6ajZ+VeCwZNUbRFxvbLW/mvCkp0ykjH87t EvvfJevyoWO+ahsdjapMkLx3v/EOfMWfDF2dajFrfm7bs/uiBiHvKnBtlcVfyj1K N0yvk6wm5eo3XWJAVGdGH1D7iaJ9AtT4MAEs35mSWg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddufeduleelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefoggffhffvvefkufgtgfesthejredtre dttdenucfhrhhomhepfdfnihhllhhirghnuceuvghrrhihfdcuoehlihhllhhirghnsehs thgrrhdqrghrkhdrnhgvtheqnecuggftrfgrthhtvghrnhepgeeivdduhefhffduffehte fhiedvfffhtdffhffgjeeifeduvdfgvdelhefhgeffnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomheplhhilhhlihgrnhesshhtrghrqdgrrhhkrd hnvghtpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthho pehpghhsqhhlqdhpvghrfhhorhhmrghntggvsehlihhsthhsrdhpohhsthhgrhgvshhqlh drohhrghdprhgtphhtthhopehinhhfrhgrsehplhhurhgrlhhkihhtrdhmvg X-ME-Proxy: Feedback-ID: i8db94900:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 3CDA62CC0083; Sat, 17 Jan 2026 08:58:04 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 Date: Sat, 17 Jan 2026 14:58:01 +0100 From: "Lillian Berry" To: pgsql-performance@lists.postgresql.org Cc: infra@pluralkit.me Message-Id: Subject: 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 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. pluralkit=# explain (analyze, buffers, settings) select * from members where hid = 'exampl'; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Index Scan using members_hid_key on members (cost=0.43..8.45 rows=1 width=838) (actual time=0.098..0.098 rows=0.00 loops=1) Index Cond: (hid = 'exampl'::bpchar) Index Searches: 1 Buffers: shared hit=3 Settings: effective_cache_size = '40GB' Planning Time: 0.161 ms Execution Time: 0.124 ms (7 rows) Table info: pluralkit=# \d+ members Table "public.members" Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description ------------------------+-----------------------------+-----------+----------+------------------------------------------+----------+-------------+--------------+------------- id | integer | | not null | nextval('members_id_seq'::regclass) | plain | | | hid | character(6) | | not null | | extended | | | system | integer | | not null | nextval('members_system_seq'::regclass) | plain | | | color | character(6) | | | | extended | | | avatar_url | text | | | | extended | | | name | text | | not null | | extended | | | birthday | date | | | | plain | | | pronouns | text | | | | extended | | | description | text | | | | extended | | | created | timestamp without time zone | | not null | timezone('utc'::text, CURRENT_TIMESTAMP) | plain | | | display_name | text | | | | extended | | | proxy_tags | proxy_tag[] | | not null | ARRAY[]::proxy_tag[] | extended | | | keep_proxy | boolean | | not null | false | plain | | | member_visibility | integer | | not null | 1 | plain | | | message_count | integer | | not null | 0 | plain | | | description_privacy | integer | | not null | 1 | plain | | | name_privacy | integer | | not null | 1 | plain | | | avatar_privacy | integer | | not null | 1 | plain | | | birthday_privacy | integer | | not null | 1 | plain | | | pronoun_privacy | integer | | not null | 1 | plain | | | metadata_privacy | integer | | not null | 1 | plain | | | allow_autoproxy | boolean | | not null | true | plain | | | banner_image | text | | | | extended | | | uuid | uuid | | | public.gen_random_uuid() | plain | | | last_message_timestamp | timestamp without time zone | | | | plain | | | webhook_avatar_url | text | | | | extended | | | proxy_privacy | integer | | not null | 1 | plain | | | tts | boolean | | not null | false | plain | | | banner_privacy | integer | | not null | 1 | plain | | | Indexes: "members_pkey" PRIMARY KEY, btree (id) "members_by_system" btree (system) "members_hid_key" UNIQUE CONSTRAINT, btree (hid) "members_uuid_idx" btree (uuid) Check constraints: "members_avatar_privacy_check" CHECK (avatar_privacy = ANY (ARRAY[1, 2])) "members_banner_privacy_check" CHECK (banner_privacy = ANY (ARRAY[1, 2])) "members_birthday_privacy_check" CHECK (birthday_privacy = ANY (ARRAY[1, 2])) "members_description_privacy_check" CHECK (description_privacy = ANY (ARRAY[1, 2])) "members_member_privacy_check" CHECK (member_visibility = ANY (ARRAY[1, 2])) "members_metadata_privacy_check" CHECK (metadata_privacy = ANY (ARRAY[1, 2])) "members_name_privacy_check" CHECK (name_privacy = ANY (ARRAY[1, 2])) "members_pronoun_privacy_check" CHECK (pronoun_privacy = ANY (ARRAY[1, 2])) "members_proxy_privacy_check" CHECK (proxy_privacy = ANY (ARRAY[1, 2])) Foreign-key constraints: "members_system_fkey" FOREIGN KEY (system) REFERENCES systems(id) ON DELETE CASCADE Referenced by: TABLE "autoproxy" CONSTRAINT "autoproxy_autoproxy_member_fkey" FOREIGN KEY (autoproxy_member) REFERENCES members(id) ON DELETE SET NULL TABLE "group_members" CONSTRAINT "group_members_member_id_fkey" FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE TABLE "member_guild" CONSTRAINT "member_guild_member_fkey" FOREIGN KEY (member) REFERENCES members(id) ON DELETE CASCADE TABLE "switch_members" CONSTRAINT "switch_members_member_fkey" FOREIGN KEY (member) REFERENCES members(id) ON DELETE CASCADE Access method: heap pluralkit=# SELECT relname, relpages, reltuples, relallvisible, relkind, relnatts, relhassubclass, reloptions, pg_table_size(oid) FROM pg_class WHERE relname='members'; -[ RECORD 1 ]--+-------------- relname | members relpages | 816042 reltuples | 1.3412575e+07 relallvisible | 297904 relkind | r relnatts | 29 relhassubclass | f reloptions | pg_table_size | 6687031296 postgresql.conf: archive_command = '/nix/store/dz9vwg5grhvpz4v7rscdl95n7s5z8c3x-pluralkit-scripts-1/bin/pk-walg data 5432 pluralkit wal-push %p' archive_mode = 'yes' archive_timeout = 60 effective_cache_size = '40GB' hba_file = '/nix/store/0pihm0qzk2pdn1d344p8kihpa58hd7s6-pg_hba.conf' listen_addresses = 'localhost, 100.123.150.13, fdaa:9:e856:a7b:910f:0:a:102' log_destination = 'stderr' log_line_prefix = 'pluralkit-db-data' log_min_duration_statement = 1000 max_connections = 2000 max_wal_size = '1GB' min_wal_size = '80MB' port = 5432 shared_buffers = '50GB' Environment: PostgreSQL 18.1 on x86_64-pc-linux-gnu, compiled by clang version 20.1.8, 64-bit installed from nixpkgs NixOS 25.11 on Linux 6.12.61 on AMD EPYC 7351P 2x Intel SSDPELKX020T7 in RAID1 (md-raid), with LUKS, ext4 filesystem Same issue previously appeared on PostgreSQL 14, both self-compiled and from nixpkgs NixOS 24.10 on AMD Ryzen 7950X ext4 filesystem directly on single Kioxia enterprise SSD (sorry I don't remember the model) Kindly, Lillian