Re: Indexes on expressions with multiple columns and operators

From: Frédéric Yhuel <frederic(dot)yhuel(at)dalibo(dot)com>
To: Andrei Lepikhov <lepihov(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>, Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>, Christophe Courtois <christophe(dot)courtois(at)dalibo(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Subject: Re: Indexes on expressions with multiple columns and operators
Date: 2025-09-25 10:43:18
Message-ID: 9dd373f9-eb61-4ddc-aa06-99e4ff13a19d@dalibo.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 9/23/25 15:31, Frédéric Yhuel wrote:
> To get back to the topic of partitioned statistics, do you know if SQL
> Server is smart enough to handle this case [1] that we discussed last
> year? (with filtered statistics)
>
> [1] https://www.postgresql.org/message-id/flat/b860c71a-7cab-4d88-
> ad87-8c1f2eea9ae8%40dalibo.com
>

Sorry, it doesn't make any sense.

First of all, it's not possible to do something like this with SQL Sever:

CREATE STATISTICS OrdersStats
ON orders (id, product_id)
WHERE product_id IN (SELECT id FROM products WHERE name = 'babar');

this is because you need to use simple scalar expressions in the filter
clause.

An even if it were possible... it would be completely useless in this
case. Sorry for the noise.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Lauro Ojeda 2025-09-25 19:34:29 Partition pruning is not happening (even in PG18)
Previous Message Frédéric Yhuel 2025-09-25 10:41:18 Re: Indexes on expressions with multiple columns and operators