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 1rMQKB-004W2Z-Qc for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jan 2024 10:24:13 +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 1rMQJB-00F8Jz-AH for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jan 2024 10:23:09 +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 1rMQJA-00F8Jq-T5 for pgsql-hackers@lists.postgresql.org; Sun, 07 Jan 2024 10:23:09 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rMQJ7-000Ibb-Ej for pgsql-hackers@postgresql.org; Sun, 07 Jan 2024 10:23:07 +0000 Received: from [192.168.1.34] (cm-27-145-180-125.revip12.asianet.co.th [27.145.180.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: a.lepikhov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 13AACE20E4E; Sun, 7 Jan 2024 13:23:02 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1704622984; bh=M5bRqz2yD3uYr5j2uvDjsjfhsSn1cU9rKATUtOs1Dbs=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=VOl0hMcnrHcH9rN56iCuU2yrIY+ICH24MgT/s/HLfjWyLZ/fYfAlnaH1LlAP4+mM+ 26fCjHGwVMGRI7u0EhcwGpEtjBO0xg24CU1i9zehpLY8AXILBBBXP4viZ+8T9ZG6Xs Ve4qbDPv1tY9YCIMBZseur1Xx2qRo1jfX+IXZtH7Wirx2ZVz6YVY4KrYUEa/Oss4mG VxLnmfp6nfSQ0/4wtJzCGlLYA6KYORvS9HNSRs2uPmHnRx3NOMhGruUJoJo1QxtYLA DfWxmIoke9oe0WaZ2jeeeqhxdCtRu1L/EHIVJjAgEZqj125BJuww2cdoFqRA3T+qn4 kMrziPvVf64aA== Message-ID: <62435ae5-15f3-4485-a8e5-4f50d3bc8c8b@postgrespro.ru> Date: Sun, 7 Jan 2024 17:22:59 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Multidimensional Histograms Content-Language: en-US To: Tomas Vondra Cc: pgsql-hackers@postgresql.org, Alexander Cheshev References: <6e92450c-8136-11d4-8f6e-501c693af5c8@enterprisedb.com> From: Andrei Lepikhov Organization: Postgres Professional In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/1/2024 06:54, Tomas Vondra wrote: > It's an interesting are for experiments, no doubt about it. And if you > choose to explore it, that's fine. But it's better to be aware it may > not end with a commit. > For the multi-dimensional case, I propose we first try to experiment > with the various algorithms, and figure out what works etc. Maybe > implementing them in python or something would be easier than C. Curiously, trying to utilize extended statistics for some problematic cases, I am experimenting with auto-generating such statistics by definition of indexes [1]. Doing that, I wanted to add some hand-made statistics like a multidimensional histogram or just a histogram which could help to perform estimation over a set of columns/expressions. I realized that current hooks get_relation_stats_hook and get_index_stats_hook are insufficient if I want to perform an estimation over a set of ANDed quals on different columns. In your opinion, is it possible to add a hook into the extended statistics to allow for an extension to propose alternative estimation? [1] https://github.com/danolivo/pg_index_stats -- regards, Andrei Lepikhov Postgres Professional