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 1riWtG-0004U8-TP for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Mar 2024 09:51:48 +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 1riWtF-00BYo1-9h for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Mar 2024 09:51:45 +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 1riWtE-00BYnt-M2 for pgsql-hackers@lists.postgresql.org; Fri, 08 Mar 2024 09:51:45 +0000 Received: from m15.mail.163.com ([45.254.50.219]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1riWt4-003SUI-DE for pgsql-hackers@lists.postgresql.org; Fri, 08 Mar 2024 09:51:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=J3MCzqnukkjByAB80ZXLq90eOiglnTGGpETl3x06/lU=; b=LC445VsScSkHxZgDb4+sie25NeHjvu0iYqPVCqi+ULaPLFvnSur+d+R6h2I82l o1VQbsPZ5H3dJrfBorgUDJv00heXK9qiqumGQUm1vTxgLPgVlKyTXTxyr2DJP58T 78hed88T2g+p/L+xP6EyqL1818doeu11jcGFWTtxLpGXI= Received: from 8235eee8a2a0 (unknown [140.205.118.78]) by gzga-smtp-mta-g0-1 (Coremail) with SMTP id _____wDHrxed3+plZirWAw--.38371S3; Fri, 08 Mar 2024 17:51:26 +0800 (CST) References: <878r2zeqsp.fsf@163.com> <87r0gqcjno.fsf@163.com> <87le6xb5j9.fsf@163.com> <87bk7sbzaj.fsf@163.com> <87msra9vgo.fsf@163.com> User-agent: mu4e 1.10.7; emacs 29.1 From: Andy Fan To: David Rowley Cc: PostgreSQL Hackers , pgsql-hackers@lists.postgresql.org Subject: Re: a wrong index choose when statistics is out of date Date: Fri, 08 Mar 2024 17:45:54 +0800 In-reply-to: Message-ID: <87edcl9hlu.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wDHrxed3+plZirWAw--.38371S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrur48ZFWrCw13AryrJr17GFg_yoWxKrc_uF Z8Aa1rZw4DXr45trWktws5ArnrJa1kJFy2kw4UXFs8KrWUJFW3Za95Wwn0qFn7Aa1Fgr9r G393ZayF9FW3ujkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_ku47UUUUU== X-Originating-IP: [140.205.118.78] X-CM-SenderInfo: x2klx3xlid0iqsrtqiywtou0bp/1tbiVAObU2VOBzAN2QAAsX List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > On Thu, 7 Mar 2024 at 23:40, Andy Fan wrote: >> >> David Rowley writes: >> > If you don't want the planner to use the statistics for the column why >> > not just do the following? >> >> Acutally I didn't want the planner to ignore the statistics totally, I >> want the planner to treat the "Const" which probably miss optimizer part >> average, which is just like what we did for generic plan for the blow >> query. > > I'm with Andrei on this one and agree with his "And it is just luck > that you've got the right answer". Any example to support this conclusion? and what's the new problem after this? -- Best Regards Andy Fan