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 1vudip-00H09D-0U for pgsql-performance@arkaria.postgresql.org; Mon, 23 Feb 2026 21:44:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vudin-00Fakx-38 for pgsql-performance@arkaria.postgresql.org; Mon, 23 Feb 2026 21:44:05 +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 1vudin-00Fakp-24 for pgsql-performance@lists.postgresql.org; Mon, 23 Feb 2026 21:44:05 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vudik-00000000voy-27i6 for pgsql-performance@postgresql.org; Mon, 23 Feb 2026 21:44:05 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-48379a42f76so37452555e9.0 for ; Mon, 23 Feb 2026 13:44:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1771883042; x=1772487842; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=YQJXR3nlzorESPNTMaHRjKtGA2+Gg//s4T5Rf0swh6I=; b=eUM6oBfXAiJwDqlZWIGJ1eNQZmWtAsx5PSBVoXyKZSAPIPqiJ17COPH2FcmlM5ygAa WGIqdt5NgUWbfHjNbTYENIRHoX3yoODTW62bwalHmypnJF8j1XKK8m3p9LyPXmhLsWR8 kc5EUCOyMrgBgsdASFyIhkMrlIB1AD+JvnCR2JUep+vFrhc6RHHDlHn8dwrnqWT+X41f UeU2VBBe50zJJKACzGDsq9I1rJS+QNW6eDH0MieLYTPNprLgEoWRUdsE6bVvZXXHWl2L sx+xDPxzMSfP6m0m8kHEpBuuzLrYMot4iAu+vTN2kWCJ2opuFD3jLoHPJZy7PUZiy9TG hPfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771883042; x=1772487842; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YQJXR3nlzorESPNTMaHRjKtGA2+Gg//s4T5Rf0swh6I=; b=nkZ46wkFTYN21E13E0Qw8xux2ZE7rC4bLOkqTjPcSSqYyh2lm7ZtJS39X10gRRajnB OGZTS4ON0DX0huMf+Qd+P/1T9lcecGlC0KVg9PO4Iw/nhNPVAfL3Yj35HmcwqLJ+535n d5ZF9Nk/aqUzcglLdJkuQE8gI+Bn69m4L0rLq3dd/oecqFjZvYVM7lh4hk1AtMnykLoK nLbcLsyhYuaKFjdvLcnGUYToGirSGT7VMoMT4ZKsZuQVsRBKgl1DmvMXnv0CPLjBEeus CxuAGI9BPW9zuhxI81NHFrtdI9CyEAuWTXvA4xMc1Z2OXvQUt3AFcJhrCBRS52nUNQX7 o6sA== X-Gm-Message-State: AOJu0YyxrYlAk2bTIhdH98P88aRjjAL21p4bR+mCnAOSr53Jgbj6aW8O jYGsMBgoOIB3+53+Q0W2E+QehmJPoEBkVZc26XTqQypc7mbs/URRU7kjPN/5EyJkdAE= X-Gm-Gg: AZuq6aJ5W9tKk9xnpMs+RUymsXDzInArT9Sff41HHjVkcu8mveKAyTU9NRx4rkpM8cK qeddmMw8eTu/dpfucmWu6bzx+qqOlDQIWuq2wEdEMKrWYUof/9lUhOQZiN+hXvyCNxV+Vxmo7Us E6bM81XaVG3oKEX4Ejd6896L+8MG6grGbTTQ8zr6n6iXuJaFVvJVyocKeY5RSmmqkvdy9QPrNNg MildbruL1gqlEwAaudTrXbnWem+LdPSXjUceF1bxrEUISJmR+K/UYRplcOWSyajZGnWWLnFIerE B5v4z/LDgZctVjeNL3OdShclagBj8BBxnIf84poHWb8+0eDaO7YsviCYIwyoSnSiUyioNG86Otb uESQc2av4ekf+wZh38BvmXk6bGmGReFK3gqKHsibJ2uySOUwQIxl5F5bwRR+2GuQzb9OfGVjmWE h/fqJk9etrEzxDfb93vkGeHXVSgY6UodGqQ8zizBo741p3sDISdjHnQswQDpFxxUiIg5hTD2HLe JbQGSkWYAoq/a3exqMwiz/gt2k+axjEw8JeYtxhNW9Y X-Received: by 2002:a05:600c:37cd:b0:47d:586e:2fea with SMTP id 5b1f17b1804b1-483a9605ce0mr193427835e9.15.1771883041677; Mon, 23 Feb 2026 13:44:01 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D (210.144.128.164.static.wline.lns.ent.cust.swisscom.ch. [164.128.144.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483a9b7fc8fsm195381905e9.7.2026.02.23.13.44.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 13:44:01 -0800 (PST) Message-ID: <5cd3d1e119e82e0cd79e0a55c4a9602fa3034392.camel@cybertec.at> Subject: Re: unstable query plan on pg 16,17,18 From: Laurenz Albe To: Attila Soki Cc: pgsql-performance@postgresql.org Date: Mon, 23 Feb 2026 22:44:00 +0100 In-Reply-To: <68CC1E87-6935-4CE9-8D69-5335860C70E8@gmx.net> References: <1695A676-062B-47C5-B302-91E2357DC874@gmx.net> <68CC1E87-6935-4CE9-8D69-5335860C70E8@gmx.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2026-02-23 at 22:19 +0100, Attila Soki wrote: > To "switch" between the ok and wrong plans I execute > vacuumdb -Upostgres -vZ -t schema1.table_k db1 > multiple times (1x-3x) until the plan flips. So I thought the table shoul= d already have been analyzed. > In my first email I called table_k as the "tbl_used_in_query" Ok, I see. Then a simple ANALYZE won't do. Perhaps the column needs more detailed statistics? ALTER TABLE schema1.table_k ALTER dp_end_dat SET STATISTICS 1000; ANALYZE schema1.table_k (dp_end_dat); > or have I misunderstood that with the analyze? No; I missed that point. Yours, Laurenz Albe