Re: BUG #16745: delete does not prune partitions on declarative partitioned table

From: Christian <akattunga(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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 22:04:41
Message-ID: CAFD6L670C1vCP40qo3RAAb3iTmDiB_4bh27HMb0TP+ZQNq+3FQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ok so this is a known issue.

I test the following command and works fine (it select only one partition)
but I'm don't like to much the execute command:

execute 'DELETE FROM FAC_ITEM WHERE FCODDIST='''||DSTCOD||''' AND
FSUCURS='||SUCCOD||'::integer AND
FFECHAI='''||to_char(FECHAI,'yyyy-mm-dd')||''' AND FIMPNUM<>'||IMPNUM;

Is there any other workaround?

El mié, 25 nov 2020 a las 18:58, Tom Lane (<tgl(at)sss(dot)pgh(dot)pa(dot)us>) escribió:

> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > 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?
>
> No. There's work afoot to improve this, but it wasn't any better before.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2020-11-25 22:41:50 Re: BUG #16745: delete does not prune partitions on declarative partitioned table
Previous Message Tom Lane 2020-11-25 21:58:01 Re: BUG #16745: delete does not prune partitions on declarative partitioned table