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 1v10Um-003VUk-Sg for pgsql-performance@arkaria.postgresql.org; Tue, 23 Sep 2025 10:43:40 +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 1v10Uj-004y7v-Tt for pgsql-performance@arkaria.postgresql.org; Tue, 23 Sep 2025 10:43:37 +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.94.2) (envelope-from ) id 1v10Uj-004y7m-Ju for pgsql-performance@lists.postgresql.org; Tue, 23 Sep 2025 10:43:37 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v10Uf-002MLT-2M for pgsql-performance@lists.postgresql.org; Tue, 23 Sep 2025 10:43:37 +0000 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3ee12a63af1so2379968f8f.1 for ; Tue, 23 Sep 2025 03:43:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758624214; x=1759229014; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=T3tHS1c4GaZQptTIz4W8sLJDRyTfxxlgim4NI7c7ZOM=; b=FK2Wh8qq0GZuPOpe73eV9mYzgCM02O+UuVlj2Q+DdyNHrSsp3HEtHXQMd+4JGwsQQt wGAqei5GSTgVas9cbblwjRU4zvi5xb1K4LMhbQMnjrB8/bzbvOS0DN8EUvdwR2L0yXNl VV3sTa90SoFHeiWnhseBRLI6YVBS/x/sI5TZ5vYvpC9kVvkcKg1f7QmkbLehiEaxdwwr LZZv4bo5bI/YjYAX/e2R2+Xmg/afabFbCKt+L5f/0jx26LApSIMErGK/2wsWqZtZOw85 qM7oPJFvJLaCDL7nWfPrZDda1nx61ELuAmvhju5yB97ITRwgaZW0Jk31POgk3jry8SvI GV4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758624214; x=1759229014; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=T3tHS1c4GaZQptTIz4W8sLJDRyTfxxlgim4NI7c7ZOM=; b=e2UKoai6RAOwvtGRxfcDXCaR3xDsgSinpWsvQY+6lT54KqPvbttOEMdr7RCL9KKSus KZ9CDA7WtjboSZFn/qoHuv77XdLocYpJrhb2COSemp8Vbkobg2DokejwdILIBr59wem8 7SfQmPmC4EEAFzLJGjJbsGRY5k4C4jgzP+4LkMDZBFV/V1gD3CvL7ekBPa6V29ctoNul IjH23QcbAYvFDmY1cNlpwHM2sPK/h9DITZMNYPRV2AfRcumX+9981qW9QxNj0V4NLeh7 UcaJQfxHpJqJI40mdEvynN/AzrP3ltNRIFoe77c5l5xfCLXf7nwEHMVYEk4+lEaAhInV luuw== X-Gm-Message-State: AOJu0YxShS4HnxUdN8N53c0DcAJADtkA2dVMG7dUTFF23C0GyDXNDJsX zSuOWFQU/2TK4UUpWcosMyc1K2XHooj9EdiiSNs1/rX9H6LPRHWqX30c X-Gm-Gg: ASbGncvBWq6POFiUxqClcJ+8mCh87L2gaWol0A/PXAc1WT0kbLzRDvX4efoGts19Idp TaGMPMK9D6yWXey2unpEmsoKjmXQOXlTmVoEN1R5qqQS0WOveePs5Z6cjPDAXpLR4cwYauuRFh8 CjhhMltY3EmjXbUQiVP3z2oUh0NaYgAkn/pa8lFoPkEb69PbGvwbalbUPHjGm8/FT8QNw6ZfOVF ewJzeVmzw85P516pofRWqq1AWxS1w5nNQmRcUCp4nSPkAA2AaRqvXSwxzOiKTZdEDvJN9dGLRyW SvQ7TD7v4QMGcoSiD+C7StxLOmM8EE1jJsz4TZAGLLW99deU9a7OP6fhnZg+mAca5tdwnYYyTu9 QhROw41qM3BJZqT/by866I7QDEFjjqgO1GQ== X-Google-Smtp-Source: AGHT+IFTFAgqTTIs90HNvzEr1s/X5NXa4xLjQD7HaWWNVHcPQetN8TOy0HuLyEeLEBnGEJ62eELwDA== X-Received: by 2002:a05:6000:2409:b0:3ec:2ef7:2134 with SMTP id ffacd0b85a97d-405c5bd8634mr2022912f8f.18.1758624213647; Tue, 23 Sep 2025 03:43:33 -0700 (PDT) Received: from [192.168.15.124] ([80.251.191.198]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4613d42bee6sm286858525e9.15.2025.09.23.03.43.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Sep 2025 03:43:33 -0700 (PDT) Message-ID: Date: Tue, 23 Sep 2025 12:43:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Indexes on expressions with multiple columns and operators To: =?UTF-8?Q?Fr=C3=A9d=C3=A9ric_Yhuel?= , Tom Lane Cc: "pgsql-performance@lists.postgresql.org" , Jehan-Guillaume de Rorthais , Christophe Courtois , Laurenz Albe References: <1507576.1758120083@sss.pgh.pa.us> <62133334-b844-4d0b-b248-1a8446757e5f@dalibo.com> <1916727.1758209549@sss.pgh.pa.us> <1972974.1758213639@sss.pgh.pa.us> <76fbd9ef-1fbb-49f0-bc8b-844462b18d1d@dalibo.com> <2432873.1758387110@sss.pgh.pa.us> <6ad08c0c-2c03-4b30-b5a7-dc486aa29c52@dalibo.com> <493a013c-63d1-467a-b9ec-352f77baf37a@dalibo.com> <9756a3e9-5dea-4506-a077-72a4d9c302df@gmail.com> Content-Language: en-US From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 23/9/2025 12:20, Frédéric Yhuel wrote: > On 9/22/25 23:15, Andrei Lepikhov wrote: >> It may solve at least one issue with the 'dependencies' statistics: a >> single number describing the dependency between any two values in the >> columns often leads to incorrect estimations, as I see. > > For what it's worth, I've never encountered a case in my life as a > PostgreSQL support engineer where the 'dependency' kind could be useful. > I only successfully used the 'mcv' kind once (and that was only > partially successful, as it fixed the estimates but not the plan).Thanks for your feedback! I also don't think the 'dependencies' statistics are very useful now, especially considering how many computational resources it is needed in case of multiple columns involved. But is it the same for the 'distinct' statistics? It seems you should love it - the number of groups in GROUP-BY, DISTINCT, and even HashJoin should be estimated more precisely, no? -- regards, Andrei Lepikhov