Partitionning: support for Truncate Table WHERE
От | legrand legrand |
---|---|
Тема | Partitionning: support for Truncate Table WHERE |
Дата | |
Msg-id | AM4PR03MB1713110B24105BE0A9720C2890820@AM4PR03MB1713.eurprd03.prod.outlook.com обсуждение исходный текст |
Ответы |
Re: Partitionning: support for Truncate Table WHERE
|
Список | pgsql-hackers |
<div dir="ltr" id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;"><p>Hello,<p><br/><p>Working in a DSSenvironment, we often need to truncate table partitions regarding a WHERE condition and have to:<p>- query the dictionnaryto identify thoses partitions,<p>- build SQL statements,<p><span>- truncate all partitions covered by the WHEREcondition <br /></span><p><span>- eventually delete the rest ...</span><p>- perform additionnal maintenance tasks<br/><p><br /><p>Wouldn't it be possible to make it possible directly in SQL as a TRUNCATE TABLE WHERE syntax ?<br /><p>Ihave done something similar using a procedure in Oracle:<p>- identifying partitions using oracle rowids by a SELECT usingthe same WHERE conditions<p>- for each partition check if data NOT in WHERE condition<p>- then DELETE WHERE orTRUNCATE PARTITION depending of data distribution. <br /><p><br /><p><br /><p>Maybe there are some other constrainst likelocking, FK disabling/enabling, indexes rebuild ...<p><br /><p>Would be pleased to ear your feedback regarding this.<p><br/><p>Regards<p>PAscal<br /></div>
В списке pgsql-hackers по дате отправления: