From: | legrand legrand <legrand_legrand(at)hotmail(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Partitionning: support for Truncate Table WHERE |
Date: | 2016-12-06 23:29:53 |
Message-ID: | AM4PR03MB1713110B24105BE0A9720C2890820@AM4PR03MB1713.eurprd03.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
Working in a DSS environment, we often need to truncate table partitions regarding a WHERE condition and have to:
- query the dictionnary to identify thoses partitions,
- build SQL statements,
- truncate all partitions covered by the WHERE condition
- eventually delete the rest ...
- perform additionnal maintenance tasks
Wouldn't it be possible to make it possible directly in SQL as a TRUNCATE TABLE WHERE syntax ?
I have done something similar using a procedure in Oracle:
- identifying partitions using oracle rowids by a SELECT using the same WHERE conditions
- for each partition check if data NOT in WHERE condition
- then DELETE WHERE or TRUNCATE PARTITION depending of data distribution.
Maybe there are some other constrainst like locking, FK disabling/enabling, indexes rebuild ...
Would be pleased to ear your feedback regarding this.
Regards
PAscal
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2016-12-07 01:58:19 | Re: Separate connection handling from backends |
Previous Message | Andres Freund | 2016-12-06 23:22:31 | Re: WIP: Faster Expression Processing and Tuple Deforming (including JIT) |