From: | tender wang <tndrwang(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | [question] multil-column range partition prune |
Date: | 2023-08-10 10:16:00 |
Message-ID: | CAHewXNkpULo0ipTJCydNE0-oT2Xnh+BSMzBy+rgthNegSdKY8w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I have an range partition and query below:
create table p_range(a int, b int) partition by range (a,b); create table
p_range1 partition of p_range for values from (1,1) to (3,3); create table
p_range2 partition of p_range for values from (4,4) to (6,6); explain
select * from p_range where b =2;
QUERY PLAN
--------------------------------------------------------------------------
Append (cost=0.00..76.61 rows=22 width=8)
-> Seq Scan on p_range1 p_range_1 (cost=0.00..38.25 rows=11 width=8)
Filter: (b = 2)
-> Seq Scan on p_range2 p_range_2 (cost=0.00..38.25 rows=11 width=8)
Filter: (b = 2)
(5 rows)
The result of EXPLAIN shows that no partition prune happened.
And gen_prune_steps_from_opexps() has comments that can answer the result.
/*
* For range partitioning, if we have no clauses for the current key,
* we can't consider any later keys either, so we can stop here.
*/
if (part_scheme->strategy == PARTITION_STRATEGY_RANGE &&
clauselist == NIL)
break;
But I want to know why we don't prune when just have latter partition key
in whereClause.
Thanks.
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2023-08-10 10:26:37 | Re: [PATCH] Add loongarch native checksum implementation. |
Previous Message | Alvaro Herrera | 2023-08-10 10:06:54 | Re: pgsql: Ignore BRIN indexes when checking for HOT udpates |