From: | Christian <akattunga(at)gmail(dot)com> |
---|---|
To: | Christian Pradelli <akattunga(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #16745: delete does not prune partitions on declarative partitioned table |
Date: | 2020-11-25 21:40:11 |
Message-ID: | CAFD6L64a-YAid83M808KLBfsfQuYHQ-yhjQ3Ou+HRgqX9L5uXw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
I investigated a little more and I found that the problem exists in PG 12
too.
I found that following command scan all partitions:
delete FROM FAC_ITEM WHERE FCODDIST='' AND FSUCURS=1 AND
FFECHAI=current_date;
but if I replace current_date by a literal, it prune non
necessary partitions and scan only the right partition
delete FROM FAC_ITEM WHERE FCODDIST='' AND FSUCURS=1 AND
FFECHAI='2020-11-25';
El mié, 25 nov 2020 a las 18:13, PG Bug reporting form (<
noreply(at)postgresql(dot)org>) escribió:
> The following bug has been logged on the website:
>
> Bug reference: 16745
> Logged by: Christian Pradelli
> Email address: akattunga(at)gmail(dot)com
> PostgreSQL version: 13.1
> Operating system: Ubuntu
> Description:
>
> Today I upgrade from PG-12 to PG-13
>
> Now I detect that delete does not prune partitions on declarative
> partitioned table.
>
> table structure
>
> CREATE TABLE public.fac_item
> (
> ffacnum integer NOT NULL,
> fcoddist character varying(15) COLLATE pg_catalog."default",
> fpromoc character varying(1) COLLATE pg_catalog."default",
> fvended character varying(15) COLLATE pg_catalog."default",
> fcodpro character varying(15) COLLATE pg_catalog."default",
> fean character varying(15) COLLATE pg_catalog."default",
> fcantid double precision,
> ftotal double precision,
> ffechai date NOT NULL,
> ffechaf date,
> fartuni integer,
> fimpnum integer,
> fsucurs integer,
> fpreref numeric(18,6),
> fcliint integer,
> fdescue double precision,
> fvenpre numeric(18,6),
> CONSTRAINT pk_fac_item PRIMARY KEY (ffacnum, ffechai)
> ) PARTITION BY RANGE (ffechai);
>
> If I execute:
>
> select * FROM FAC_ITEM WHERE FCODDIST='' AND FSUCURS=1 AND
> FFECHAI=current_date;
>
> it use only one partition
>
> but:
>
> delete FROM FAC_ITEM WHERE FCODDIST='' AND FSUCURS=1 AND
> FFECHAI=current_date;
>
> scan all partitions
>
> Is there any regression?
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-11-25 21:58:01 | Re: BUG #16745: delete does not prune partitions on declarative partitioned table |
Previous Message | Tom Lane | 2020-11-25 21:20:07 | Re: BUG #16743: psql doesn't show whole expression in stored column |