Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o96QL-0004Je-3G for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Jul 2022 14:54:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o96QJ-0006RG-SO for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Jul 2022 14:54:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o96QJ-0006R7-By for pgsql-bugs@lists.postgresql.org; Wed, 06 Jul 2022 14:54:39 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o96QF-0002Qp-Qs for pgsql-bugs@lists.postgresql.org; Wed, 06 Jul 2022 14:54:38 +0000 Received: by mail-wr1-x42e.google.com with SMTP id s1so22436556wra.9 for ; Wed, 06 Jul 2022 07:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aiven.io; s=google; h=from:to:cc:subject:date:message-id:organization:in-reply-to :references:mime-version:content-transfer-encoding; bh=l+N+olqk4JAjC8hVMg76lSZGcC6+elE7tuzXr0VTpqk=; b=DeUrRnVuwCNvO/4GcM9Ska69IM8RdvpK5qrTb1D2Pmfvi3QqQkcXOV4JkkVUuJH/6T FLnJOExysL2GsCzWsvxJk4ES+WdtaLsx7U0B9cCa10foFLp2cHoa7R3EDPQVliLIpyBO /3H3v38FSvKHe1t+x+b8mAvXoN7jkRpHjo3g4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :in-reply-to:references:mime-version:content-transfer-encoding; bh=l+N+olqk4JAjC8hVMg76lSZGcC6+elE7tuzXr0VTpqk=; b=UXhyp2shoHs+I8DGegx2Z5uMZ4UXXGmnang/t72BPym+vAUfsf/Xg3Lgpcfi1okdqa 4QDWYJQwukN8hGV8aQuErxz7QvVgIAE7e9e9cade9rNQYMucTrsDx3svAYuc/gEg61dv 0+7rVwFJAcrfwsiZlqKEqqqVPz/QmKkSlM4c40rG4GIBJ1eXpc7VPydyJWxrc9ot1btx AnukT7m2bHaJnJWGfLU9eC6xwkOcGDuG6LmJ6FF0s20GpCQU1yiw2RjSHrFzTD9Kjsru uqbdpEAQgJ9JItfCfxGkPhQo/8+W4Q2mKTa5WHsb8lWuxZF+xfYlzlK9H1vU2zV/0FM+ +k5Q== X-Gm-Message-State: AJIora9g82fzp2RARS1wnd4acY6J1/ZNPBhR/phIFM+TFWEI8GtzZMcu y+3cTtyEaTnT7e0PpbTE6aYfBg== X-Google-Smtp-Source: AGRyM1vhv7zJ53EX9Kt85fypuhZKM58HESkLbqbQpd7+W/uEu+4BQuwuUjtgA07nc+8i3IR0RhJbrQ== X-Received: by 2002:a05:6000:114f:b0:21d:6e51:6e55 with SMTP id d15-20020a056000114f00b0021d6e516e55mr11969044wrx.132.1657119273496; Wed, 06 Jul 2022 07:54:33 -0700 (PDT) Received: from aivenronan.localnet ([45.13.105.93]) by smtp.gmail.com with ESMTPSA id c8-20020a7bc848000000b0039c457cea21sm25432639wml.34.2022.07.06.07.54.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 07:54:33 -0700 (PDT) From: Ronan Dunklau To: Tom Lane Cc: Hung Nguyen , pgsql-bugs@lists.postgresql.org, "rjuju123@gmail.com" Subject: Re: index cost estimation Date: Wed, 06 Jul 2022 16:52:09 +0200 Message-ID: <2187702.iZASKD2KPV@aivenronan> Organization: aiven In-Reply-To: <2194637.1657118489@sss.pgh.pa.us> References: <2834175.e9J7NaK4W3@aivenronan> <2194637.1657118489@sss.pgh.pa.us> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Le mercredi 6 juillet 2022, 16:41:29 CEST Tom Lane a =E9crit : > Hm, so it'd seem this probably could happen when comparing *any* > non-btree index to a btree index, because I don't think we are > particularly careful with CPU cost estimation for any of the > other index types. If we do something about this, we probably > have to look at all of them. =46or gist and sp-gist, a descent cost is taken into account, by estimating= the=20 tree height so that particular effect is mitigated. Whether the cpu cost=20 estimation is sensible regarding to btree is another topic, but at least th= e=20 index cost doesn't vanish when inside a loop. Hash, brin and bloom are quite different, so maybe another examination woul= d be=20 required but probably outside the scope of this bug report.=20 =2D-=20 Ronan Dunklau