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.94.2) (envelope-from ) id 1tOM47-005mWa-Lw for pgsql-performance@arkaria.postgresql.org; Thu, 19 Dec 2024 19:20:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tOM46-00GLGR-GC for pgsql-performance@arkaria.postgresql.org; Thu, 19 Dec 2024 19:20:06 +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.94.2) (envelope-from ) id 1tOM46-00GLF0-60 for pgsql-performance@lists.postgresql.org; Thu, 19 Dec 2024 19:20:05 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tOM43-000QXK-As for pgsql-performance@lists.postgresql.org; Thu, 19 Dec 2024 19:20:04 +0000 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2f42992f608so840435a91.0 for ; Thu, 19 Dec 2024 11:20:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734636002; x=1735240802; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=We1s8/JnjBbXRgD4gFaFo/1nF9SHPHVVkZpNbl7rFIQ=; b=CmRc/JH4qOdiCQs5yXSDWKR1jwmbnc4ApJOE6ChuxtThkaJVPAQW1wsvnM1/hW3qzb PuMwP/r1SCXKZgMDMaf0nrQ9AKZIi/y/RlJjSLRL+oMnUmCxZVZjh9ZuChPkKVBuJDHD lbpWXaA59sbiQprJAsbcBpOCl63S/NCGIPBuT9Ug/Os6uB0+tefYHzumuIn46Rqqrlzg dwD6dxHMd33v6Q/gmeb4/QORVIgIhPuUjMDkw0aJxBM5GNJ+99dcQKq5PoZ/r+chrpHX BpsJDPVhAJJp5emiyQNHqgIc/T1n615zO3/h95nvHsTmhVlBJ4kS73IXyYWnB360HC7K Ow4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734636002; x=1735240802; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=We1s8/JnjBbXRgD4gFaFo/1nF9SHPHVVkZpNbl7rFIQ=; b=iyzsffiv+EgJcZDniWH6EP7YRE8NmOj3GKvKPS8NDap5QUigS/Qi01qomIf+oahopo vqpprOiFX0dq3Ho8iLtknElj/Wl38Ob8nGNG4fycYZ8PF3bgbsmXg11hEkBRfds5prLC wkPDXiMlJzaKgYLpz0/2Jatt36LCvsyP0WWmjvVDYxkYJbvYXjbEwyXuNbyiM9cHnsq1 UjVutp/x+hR7wzSi23Afb2gbbQ+6pSE8mNP90+MyW0kTjg5IWZZjs1rtpU+XPgK7j3Cg YjqQ7Xwb3dBemX1fUTK+9VPHXLVFOlCBjdjm2UBfmkk1xG2D2G9cn2i/uA3NggnOaN19 d2gw== X-Gm-Message-State: AOJu0YxV0jaLvciHsDMXNh2foaPp6wBKE2FOaBVTxq4Mlg/P+EoFRxTr LngN/U1mqE73a2ommcWXcjmw+tsIJ8F29KRuAbe22jYLVv3K1FO37lRwvMARGuavmxhHlbcvpPm a8rJwJAy79IAGfgqtFxjTQYFtiWVOpQ== X-Gm-Gg: ASbGnctz1oar51oJWqM5krEZrhp1k6Gnn4VYQmtp+1BzSv3CLrPJjRg4Sd4QSysLPLC a5xsy8WLXz9xnbN4cjz+CXEPjyKwl4xf+nUSY X-Google-Smtp-Source: AGHT+IFiRG3h9LLCk1hSB3w2SZB0nl69TXcaRC/WlsGTMZ+vrTe/TTQfwtZiqTPlwcnnyp1YJXtSIjDtkAWKomA3TFs= X-Received: by 2002:a17:90b:4ed0:b0:2ea:37b4:5373 with SMTP id 98e67ed59e1d1-2f452e22604mr262086a91.10.1734636002021; Thu, 19 Dec 2024 11:20:02 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jon Zeppieri Date: Thu, 19 Dec 2024 14:19:50 -0500 Message-ID: Subject: Re: Why a bitmap scan in this case? To: Greg Sabino Mullane Cc: pgsql-performance@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Dec 19, 2024 at 2:09=E2=80=AFPM Jon Zeppieri w= rote: > > The row estimate is not good. The query estimates 317919 rows but > there are only 27701. There is some correlation here; if end_on is > null, start_on is a lot more likely to be recent, so maybe extended > statistics would be useful here. > Though, given that the index only contains rows where end_on is null, it seems odd that the planner would estimate more rows than are present in the index. That said, I have no idea whether the planner uses that sort of information. -J