Database Cleanup utility objects

To determine which tables and which rows to delete, the Database Cleanup utility uses the CLEANCONF table.

The following table describes the object types that have SQL statements available for the Database Cleanup utility to use. The utility runs these statements to remove objects from the database. These SQL statements are stored in the CLEANCONF database table. If you need to delete different object types or delete any listed object type under different conditions, we can add rows to the CLEANCONF table to add the appropriate custom SQL statements. The SQL statements listed for the following objects are example cleanup statements for use with a DB2 database. The following files includes all of the cleanup statements that are provided with WebSphere Commerce for each database type.

Notes:


Objects with provided cleanup SQL statements


Activity

Object name Object type Sequence SQL Statement namearg daysarg
activity obsolete 1 delete from CTXMGMT where days(CURRENT TIMESTAMP) - days(LASTACCESSTIME) >= ? no yes


Address

Object name Object type Sequence SQL Statement namearg daysarg
address obsolete 1 delete from address where status = 'T' and (days(CURRENT TIMESTAMP) - days(lastcreate)) >= ? and (address_id not in (select distinct address_id from orderitems where address_id is not null)) and (address_id not in (select distinct address_id from orders where address_id is not null)) and (address_id not in (select distinct allocaddress_id from orderitems where allocaddress_id is not null)) no yes


ATP inventory

Object name Object type Sequence SQL Statement namearg daysarg
atp_inventory obsolete 1 delete from receipt where qtyonhand = 0 and qtyinkits = 0 and receipt_id not in (select distinct receipt_id from ordpickhst where receipt_id is not null) and receipt_id not in (select distinct receipt_id from ordshiphst where receipt_id is not null) no no


Attachments

Object name Object type Sequence SQL Statement namearg daysarg
attachment markedfordelete 1 select attachmenturl from attachment where cast(attachment_id as char(60)) != cast(attachmenturl as char(254)) and markfordelete =1 no no
attachment markedfordelete 2 delete from attachment where markfordelete =1 no no

Object name Object type Sequence SQL Statement namearg daysarg
attachment obsolete 1 delete from attachment where days(current timestamp) - days(timeupdated) >=? and (attachusg_id= 'Contract' or attachusg_id= 'RFQ' or attachusg_id= 'PattributeAttachment') and attachment_id not in (select distinct attachment_id from trdattach) and attachment_id not in (select distinct attachment_id from pattrvalue where attachment_id is not null) no yes


Base items

Object name Object type Sequence SQL Statement namearg daysarg
baseitem obsolete 1 delete from baseitem where markfordelete = 1 and baseitem_id not in (select baseitem_id from catentry where baseitem_id is not null) and baseitem_id not in (select distinct baseitem_id from itemspc where markfordelete = 0 and itemspc_id in (select distinct itemspc_id from orderitems where itemspc_id is not null) or itemspc_id in (select distinct itemspc_id from oicomplist where itemspc_id is not null) or itemspc_id in (select distinct itemspc_id from versionspc where versionspc_id in (select distinct versionspc_id from receipt)) or itemspc_id in (select distinct itemspc_id from radetail) or itemspc_id in (select distinct itemspc_id from bkordalloc) or itemspc_id in (select distinct itemspc_id from invreserve where itemspc_id is not null) or itemspc_id in (select distinct itemspc_id from rmaitem) or itemspc_id in (select distinct itemspc_id from rmaitemcmp) or itemspc_id in (select distinct itemspc_id from catentry where itemspc_id is not null)) no no


Cache invalidations

Object name Object type Sequence SQL Statement namearg daysarg
CACHEIVL obsolete 1 delete from cacheivl where (days(CURRENT TIMESTAMP) - days(inserttime)) >= ? no yes


Calculation code

Object name Object type Sequence SQL Statement namearg daysarg
calculation_code markedfordelete 1 delete from calcodedsc where calcode_id in (select calcode_id from calcode where published = 2) no no
calculation_code markedfordelete 2 delete from calcodemgp where calcode_id in (select calcode_id from calcode where published = 2) no no
calculation_code markedfordelete 3 delete from catencalcd where calcode_id in (select calcode_id from calcode where published = 2) no no
calculation_code markedfordelete 4 delete from shpmodclcd where calcode_id in (select calcode_id from calcode where published = 2) no no

Object name Object type Sequence SQL Statement namearg daysarg
calculation_code obsolete 1 delete from calcode where published = 2 and calcode_id not in (select distinct calcode_id from ordadjust where calcode_id is not null) and calcode_id not in (select distinct calcode_id from stencalusg where calcode_id is not null) and calcode_id not in (select distinct calcode_id from ordcalcd where calcode_id is not null) and calcode_id not in (select distinct calcode_id from ordicalcd where calcode_id is not null) no no


Calculation rule

Object name Object type Sequence SQL Statement namearg daysarg
calculation_rule obsolete 1 delete from CALRULE where ENDDATE is not null AND (days(CURRENT TIMESTAMP) - days(ENDDATE) >= ?) no yes


Categories

Object name Object type Sequence SQL Statement namearg daysarg
catalog_group obsolete 1 delete from catgroup where markfordelete = 1 no no


Catalog entries

Object name Object type Sequence SQL Statement namearg daysarg
catentry made_to_order 2 update catentry set state='D' where catentry_id in (select catentry_id_parent from catentrel, catentry where catentry_id_child=catentry_id and state='D') and catentry_id not in (select catentry_id_parent from catentrel, catentry where catentry_id_child=catentry_id and state!='D') no no
catentry made_to_order 3 update rfqrspprod set catentry_id = null where catentry_id in (select catentry_id from catentry where state = 'D') no no
catentry made_to_order 4 delete from catentry where state='D' no no


Client location

Object name Object type Sequence SQL Statement namearg daysarg
clientlocation obsolete delete from clientlocation where modificationtime <= CURRENT TIMESTAMP - ? days no yes


Content versions

Object name Object type Sequence SQL Statement namearg daysarg
content_version inactive 10 delete from cmversninfo where cmversninfo_id in (select cmversninfo_id from cmversninfo where ((days(current timestamp) - days(createtime)) >= ?) and cmversninfo_id not in (select cmversninfo_id from cmactversn)) no yes

Object name Object type Sequence SQL Statement namearg daysarg
content_version catalog 10 delete from cmversninfo where ui_object_name in ( 'SalesCatalog') and ((days(current timestamp) - days(createtime)) >= ?) and cmversninfo_id not in (select cmversninfo_id from cmactversn) no yes

Object name Object type Sequence SQL Statement namearg daysarg
content_version catalog_group 10 delete from cmversninfo where ui_object_name in ( 'CatalogGroup', 'SalesCatalogGroup') and ((days(current timestamp) - days(createtime)) >= ?) and cmversninfo_id not in (select cmversninfo_id from cmactversn) no yes

Object name Object type Sequence SQL Statement namearg daysarg
content_version catalog_entry 10 delete from cmversninfo where ui_object_name in ( 'Product', 'ProductSKU', 'CatalogGroupSKU', 'Bundle', 'Kit') and ((days(current timestamp) - days(createtime)) >= ?) and cmversninfo_id not in (select cmversninfo_id from cmactversn) no yes


Content history

Object name Object type Sequence SQL Statement namearg daysarg
content_history obsolete_for_base 10 delete from cmprmyobj where (days(current timestamp) - days(lastupdate)) >= ? and workspace = 'IBM_WC_BASE' and taskgrp='IBM_WC_BASE' no yes
content_history obsolete_taskgroups 10 delete from cmftaskgrp where status in (5,6,12,13) and commitdate < (current timestamp - ? days) no yes
content_history obsolete_taskgroups 20 delete from cmfwkspc o where o.status in (2,3) and not exists (select 1 from cmfwstgrel i where o.cmfwkspc_id = i.cmfwkspc_id) no yes
content_history obsolete_taskgroups 30 delete from cmftask o where o.status = 2 and (o.completedate < (current timestamp - ? days) or not exists (select 1 from cmftgtskrel i where o.cmftask_id = i.cmftask_id)) no yes
content_history obsolete_taskgroups 40 delete from cmprmyobj o where o.lastupdate < (current timestamp - ? days) or (o.workspace != 'IBM_WC_BASE' and not exists (select 1 from cmftaskgrp i where o.taskgrp = i.identifier)) no yes


Contract

Object name Object type Sequence SQL Statement namearg daysarg
contract obsolete 4 delete from aprvstatus where flowtype_id in (select flowtype_id from flowtype where identifier = 'ContractSubmit') and entity_id not in (select trading_id from trading) no no
contract obsolete 5 delete from flinstance where flowtype_id in (select flowtype_id from flowtype where identifier = 'ContractSubmit') and entity_id not in (select trading_id from trading) no no


Expected inventory records

Object name Object type Sequence SQL Statement namearg daysarg
expected_inventory_records obsolete 1 delete from ra where markfordelete = 1 and ra_id not in (select distinct ra_id from receipt, radetail where receipt.radetail_id = radetail.radetail_id) no no


Expected inventory record details

Object name Object type Sequence SQL Statement namearg daysarg
expected_inventory_record_details obsolete 1 delete from radetail where markfordelete = 1 and radetail_id not in (select distinct radetail_id from receipt where radetail_id is not null) no no


File uploads

Object name Object type Sequence SQL Statement namearg daysarg
fileupload obsolete 1 delete from fileupload where days(current timestamp) - days(uploadtime) >=? no yes


Folder items

Object name Object type Sequence SQL Statement namearg daysarg
folderitem orphaned_all 10 delete from folderitem where folderitemtype='PromotionType' and reference_id not in (select px_promotion_id from px_promotion) no no
folderitem orphaned_all 20 delete from folderitem where folderitemtype='AttributeDictionaryAttributeType' and reference_id not in (select attr_id from attr) no no
folderitem orphaned_all 30 delete from folderitem where folderitemtype='MarketingContentType' and reference_id not in (select collateral_id from collateral) no no
folderitem orphaned_all 40 delete from folderitem where folderitemtype='MarketingSpotType' and reference_id not in (select emspot_id from emspot) no no
folderitem orphaned_all 50 delete from folderitem where folderitemtype='MemberGroupType' and reference_id not in (select mbrgrp_id from mbrgrp) no no
folderitem orphaned_all 60 delete from folderitem where folderitemtype='ActivityType' and reference_id not in (select dmactivity_id from dmactivity) no no

Object name Object type Sequence SQL Statement namearg daysarg
folderitem orphaned_promotion 10 delete from folderitem where folderitemtype='PromotionType' and reference_id not in (select px_promotion_id from px_promotion) no no

Object name Object type Sequence SQL Statement namearg daysarg
folderitem orphaned_attribute 20 delete from folderitem where folderitemtype='AttributeDictionaryAttributeType' and reference_id not in (select attr_id from attr) no no

Object name Object type Sequence SQL Statement namearg daysarg
folderitem orphaned_marketing 30 delete from folderitem where folderitemtype='ActivityType' and reference_id not in (select dmactivity_id from dmactivity) no no
folderitem orphaned_marketing 40 delete from folderitem where folderitemtype='MemberGroupType' and reference_id not in (select mbrgrp_id from mbrgrp) no no
folderitem orphaned_marketing 50 delete from folderitem where folderitemtype='MarketingSpotType' and reference_id not in (select emspot_id from emspot) no no
folderitem orphaned_marketing 60 delete from folderitem where folderitemtype='MarketingContentType' and reference_id not in (select collateral_id from collateral) no no


Folders

Object name Object type Sequence SQL Statement namearg daysarg
folder orphaned 10 delete from folder where parentfolder_id is not null and parentfolder_id not in (select folder_id from folder) no no


Inventory adjustment codes

Object name Object type Sequence SQL Statement namearg daysarg
inventory_adjustment_codes obsolete 1 delete from invadjcode where markfordelete = 1 and invadjcode_id not in (select distinct invadjcode_id from invadjust where invadjcode_id is not null) no no


Inventory adjustments

Object name Object type Sequence SQL Statement namearg daysarg
inventory_adjustments obsolete 1 delete from invadjust where days(CURRENT TIMESTAMP) - days(adjustmentdate) >= ? no yes


Item specification

Object name Object type Sequence SQL Statement namearg daysarg
itemspecification obsolete 1 delete from itemspc where markfordelete = 1 and itemspc_id not in (select distinct itemspc_id from orderitems where itemspc_id is not null) and itemspc_id not in (select distinct itemspc_id from oicomplist where itemspc_id is not null) and itemspc_id not in (select distinct itemspc_id from versionspc where versionspc_id in (select distinct versionspc_id from receipt)) and itemspc_id not in (select distinct itemspc_id from radetail) and itemspc_id not in (select distinct itemspc_id from bkordalloc) and itemspc_id not in (select distinct itemspc_id from invreserve where itemspc_id is not null) and itemspc_id not in (select distinct itemspc_id from rmaitem) and itemspc_id not in (select distinct itemspc_id from rmaitemcmp) and itemspc_id not in (select distinct itemspc_id from catentry where itemspc_id is not null) no no


Marketing activities

Object name Object type Sequence SQL Statement namearg daysarg
marketing_activity markedfordelete 1 delete from dmelestats where not exists (select 1 from dmelement where dmelement.dmelement_id = dmelestats.dmelement_id) no no
marketing_activity markedfordelete 2 delete from dmexpstats where not exists (select 1 from dmelement where dmelement.dmelement_id = dmexpstats.testelement_id) no no
marketing_activity markedfordelete 3 delete from dmactattr where not exists (select 1 from dmactivity where dmactivity.dmactivity_id = dmactattr.dmactivity_id) no no
marketing_activity markedfordelete 4 delete from dmemspotstats where not exists (select 1 from dmactivity where dmactivity.dmactivity_id = dmemspotstats.dmactivity_id) no no

Object name Object type Sequence SQL Statement namearg daysarg
marketing_activity obsolete 1 delete from dmactivity where enddate is not null and (days(current timestamp) - days(enddate)) >=? no yes


Marketing user behavior

Object name Object type Sequence SQL Statement namearg daysarg
marketing_userbehavior obsolete 1 delete from dmuserbhvr where days(current timestamp) - days(lastupdated) >=? no yes


Marketing logs

Object name Object type Sequence SQL Statement namearg daysarg
marketing_log obsolete 1 delete from dmexplog where days(current timestamp) - days(created) >=? no yes


Notifications

Object name Object type Sequence SQL Statement namearg daysarg
notify obsolete 1 delete from notify where not exists ( select notificationid from orders where notify.notificationid = orders.notificationid) no no


Offer

Object name Object type Sequence SQL Statement namearg daysarg
offer markfordelete 1 delete from offer where published = 2 and not exists (select 1 from orderitems where orderitems.offer_id = offer.offer_id) no no


Orders

Object name Object type Sequence SQL Statement namearg daysarg
order canceled 1 delete from orders where status ='X' and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? and orders_id not in (select orders_id from orderitems where orderitems_id in (select orderitems_id from rmaitem where orderitems_id is not null)) no yes
order canceled 3 delete from aprvstatus where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no
order canceled 4 delete from flinstance where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no

Object name Object type Sequence SQL Statement namearg daysarg
order completed 15 delete from orders where status = 'C' and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? and orders_id not in (select orders_id from orderitems where orderitems_id in (select orderitems_id from rmaitem where orderitems_id is not null)) and orders_id not in (select orders_id from orderitems where orderitems.status != 'C') no yes
order completed 20 delete from px_cdpool where px_cdpool_id in (select px_cdpool_id from px_cdusage where status = 5 and orders_id in (select orders_id from orders where status = 'C' and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? and orders_id not in (select orders_id from orderitems where orderitems_id in (select orderitems_id from rmaitem where orderitems_id is not null)) and orders_id not in (select orders_id from orderitems where orderitems.status != 'C'))) and px_cdpool_id in (select px_cdpool_id from px_cdpool where reference_id in (select px_promotion_id from px_cdspec where codetype = 1 or codetype = 2)) no yes
order completed 25 delete from aprvstatus where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no
order completed 30 delete from flinstance where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no

Object name Object type Sequence SQL Statement namearg daysarg
order deposited 15 delete from orders where status ='D' and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? and orders_id not in (select orders_id from orderitems where orderitems_id in (select orderitems_id from rmaitem where orderitems_id is not null)) no yes
order deposited 20 delete from px_cdpool where px_cdpool_id in (select px_cdpool_id from px_cdusage where status = 5 and orders_id in (select orders_id from orders where status ='D' and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? and orders_id not in (select orders_id from orderitems where orderitems_id in (select orderitems_id from rmaitem where orderitems_id is not null)))) and px_cdpool_id in (select px_cdpool_id from px_cdpool where reference_id in (select px_promotion_id from px_cdspec where codetype = 1 or codetype = 2)) no yes
order deposited 20 delete from aprvstatus where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no
order deposited 25 delete from flinstance where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no

Object name Object type Sequence SQL Statement namearg daysarg
order markfordelete 1 delete from orderitems where orders_id in (select orders_id from orders where type = 'BIN' and status = 'J') no no
order markfordelete 2 delete from orders where type = 'TRH' and status = 'X' no no

Object name Object type Sequence SQL Statement namearg daysarg
order quotation 1 delete from orders where orders_id in (select child_id from ordquotrel where reltype='markedForDelete') no no
order quotation 2 delete from ordquotrel where child_id is null and reltype='markedForDelete' no no

Object name Object type Sequence SQL Statement namearg daysarg
order shipped 15 delete from orders where status ='S' and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? and orders_id not in (select orders_id from orderitems where orderitems_id in (select orderitems_id from rmaitem where orderitems_id is not null)) no yes
order shipped 20 delete from px_cdpool where px_cdpool_id in (select px_cdpool_id from px_cdusage where status = 5 and orders_id in (select orders_id from orders where status ='S' and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? and orders_id not in (select orders_id from orderitems where orderitems_id in (select orderitems_id from rmaitem where orderitems_id is not null)))) and px_cdpool_id in (select px_cdpool_id from px_cdpool where reference_id in (select px_promotion_id from px_cdspec where codetype = 1 or codetype = 2)) no yes
order shipped 25 delete from aprvstatus where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no
order shipped 30 delete from flinstance where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no

Object name Object type Sequence SQL Statement namearg daysarg
order stale_guest 1 delete from orders where orders_id in (select o from users u, (select o.orders_id o, o.member_id m, o.status s, o.lastupdate l, i.orderitems_id i from orders o, orderitems i where o.orders_id = i.orders_id and i.inventorystatus = 'NALC' union all select o.orders_id o, o.member_id m, o.status s, o.lastupdate l, i.orderitems_id i from orders o, store s, orderitems i where o.orders_id = i.orders_id and o.storeent_id = s.store_id and inventorysystem = -2) q left join rmaitem on i = orderitems_id where rmaitem_id is null and registertype = 'G' and m = users_id and s in ('P','I','W','N') and l <= CURRENT TIMESTAMP - ? DAYS) no yes
order stale_guest 3 delete from aprvstatus where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no
order stale_guest 4 delete from flinstance where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no

Object name Object type Sequence SQL Statement namearg daysarg
order stale_non_guest 1 delete from orders where orders_id in (select o from users u, (select o.orders_id o, o.member_id m, o.status s, o.lastupdate l, i.orderitems_id i from orders o, orderitems i where o.orders_id = i.orders_id and i.inventorystatus = 'NALC' union all select o.orders_id o, o.member_id m, o.status s, o.lastupdate l, i.orderitems_id i from orders o, store s, orderitems i where o.orders_id = i.orders_id and o.storeent_id = s.store_id and inventorysystem = -2) q left join rmaitem on i = orderitems_id where rmaitem_id is null and registertype <> 'G' and m = users_id and s in ('P','I','W','N') and l <= CURRENT TIMESTAMP - ? DAYS) no yes
order stale_non_guest 3 delete from aprvstatus where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no
order stale_non_guest 4 delete from flinstance where flowtype_id in (select flowtype_id from flowtype where identifier = 'OrderProcess') and entity_id not in (select orders_id from orders) no no


Organization

Object name Object type Sequence SQL Statement namearg daysarg
organization specified 1 select attachmenturl from attachment where cast(attachment_id as char(60)) != cast(attachmenturl as char(254)) and member_id in (select orgentity_id from orgentity where orgentity_id = ?) yes no
organization specified 2 delete from member where member_id in (select orgentity_id from orgentity where orgentity_id = ?) yes no


Payment rule

Object name Object type Sequence SQL Statement namearg daysarg
PaymentRule obsolete 1 delete from edporder where order_id not in (select orders_id from orders) no no
PaymentRule obsolete 2 delete from edprma where rma_id not in (select rma_id from rma) no no
PaymentRule obsolete 3 delete from ppcpayinst where (( order_id is not null and order_id not in (select orders_id from orders)) and ( rma_id is null or (rma_id is not null and rma_id not in (select rma_id from rma)))) or (order_id is null and (rma_id is not null and rma_id not in (select rma_id from rma))) no no

Object name Object type Sequence SQL Statement namearg daysarg
PaymentRule sensitive_delete 4 delete from ppcextdata where ppcpayinst_id in (select ppcpayinst_id from ppcpayinst where order_id in (select orders_id from orders where status='D' and lastupdate <= (current timestamp - ? days))) no yes
PaymentRule sensitive_delete 5 delete from ppcextdata where ppcpayinst_id in (select ppcpayinst_id from ppcpayinst where rma_id in (select rma_id from rma where status='CLO' and (days(CURRENT TIMESTAMP) - days(lastupdate))>= ?)) no yes


Preview token

Object name Object type Sequence SQL Statement namearg daysarg
previewtoken obsolete 1 delete from previewtoken where (days(CURRENT TIMESTAMP) - days(enddate)) >= ? or status = 'R' no yes


Promotion codes

Object name Object type Sequence SQL Statement namearg daysarg
promotion_code expired 10 delete from px_cdpool where px_cdpool_id in (select px_cdpool_id from px_cdpool where reference_id in (select px_promotion_id from px_promotion where (days(current timestamp) - days(enddate)) >= ? and px_promotion_id in (select px_promotion_id from px_cdspec where codetype = 1 or codetype = 2))) and px_cdpool_id not in (select px_cdpool_id from px_cdusage where status = 5) no yes

Object name Object type Sequence SQL Statement namearg daysarg
promotion_code markfordelete 10 delete from px_cdpool where px_cdpool_id in (select px_cdpool_id from px_cdpool where reference_id in (select px_promotion_id from px_promotion where status = 2 or status = 4 and px_promotion_id in (select px_promotion_id from px_cdspec where codetype = 1 or codetype = 2))) and px_cdpool_id not in (select px_cdpool_id from px_cdusage where status = 5) no no


Return reasons

Object name Object type Sequence SQL Statement namearg daysarg
rtnreasons obsolete 1 delete from rtnreason where markfordelete = 1 and rtnreason_id not in (select distinct rtnreason_id from rtnrcptdsp where rtnreason_id is not null) and rtnreason_id not in (select distinct rtnreason_id from rmaitem where rtnreason_id is not null) no no


Requests for quotes

Object name Object type Sequence SQL Statement namearg daysarg
rfq obsolete 2 delete from aprvstatus where flowtype_id in (select flowtype_id from flowtype where identifier = 'RFQResponse') and entity_id not in (select trading_id from trading) no no
rfq obsolete 3 delete from flinstance where flowtype_id in (select flowtype_id from flowtype where identifier = 'RFQResponse') and entity_id not in (select trading_id from trading) no no


Return merchandise authorizations (RMA)

Object name Object type Sequence SQL Statement namearg daysarg
rma abandoned 1 delete from rma where status in ('PRC', 'EDT') and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? and rma_id not in (select rma_id from rmaitem where rmaitem.status in ('APP', 'MAN')) and rma_id not in (select rma_id from rtnreceipt) no yes

Object name Object type Sequence SQL Statement namearg daysarg
rma canceled 1 delete from rma where status = 'CAN' and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? no yes

Object name Object type Sequence SQL Statement namearg daysarg
rma not_approved 1 delete from rma where status = 'PND' and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? and rma_id not in (select rma_id from rmaitem where rmaitem.status in ('APP', 'MAN') ) and rma_id not in (select rma_id from rtnreceipt) no yes

Object name Object type Sequence SQL Statement namearg daysarg
rma approved_or_partly_approved 1 delete from rma where status = 'PND' and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? and rma_id in (select rma_id from rmaitem where rmaitem.status in ('APP', 'MAN') ) and rma_id not in (select rma_id from rtnreceipt) no yes

Object name Object type Sequence SQL Statement namearg daysarg
rma completed 1 delete from rma where status = 'CLO' and (days(CURRENT TIMESTAMP) - days(lastupdate)) >= ? no yes


Scheduled jobs

Object name Object type Sequence SQL Statement namearg daysarg
scheduled_job completed 10 DELETE FROM SCHSTATUS WHERE (SCSSTATE = 'C' OR SCSSTATE = 'CF') AND (days(CURRENT TIMESTAMP) - days(SCSEND) >= ?) no yes
scheduled_job completed 20 DELETE FROM SCHCONFIG WHERE SCCAPPTYPE = 'broadcast' AND NOT EXISTS (SELECT 1 FROM SCHACTIVE A WHERE SCHCONFIG.SCCJOBREFUM = A.SCSJOBNBR) AND NOT EXISTS (SELECT 1 FROM SCHBRDCST B WHERE SCHCONFIG.SCCJOBREFNUM = B.JOBREFNUM AND B.JOBSTATE = 'R') AND (days(CURRENT TIMESTAMP) - days(SCCSTART) >= ?) no yes
scheduled_job completed 30 DELETE FROM SCHCONFIG WHERE (SCCAPPTYPE != 'broadcast' OR SCCAPPTYPE IS NULL) AND NOT EXISTS (SELECT 1 FROM SCHACTIVE A WHERE SCHCONFIG.SCCJOBREFNUM = A.SCSJOBNBR) AND (days(CURRENT TIMESTAMP) - days(SCCSTART) >= ?) no yes


Search statistics

Object name Object type Sequence SQL Statement namearg daysarg
STAStatistics obsolete 10 delete from srchstat where (days(CURRENT TIMESTAMP) - days(logdate)) >= ? no yes


STAGLOG records

Object name Object type Sequence SQL Statement namearg daysarg
STAGLOG obsolete 1 DELETE FROM STAGLOG WHERE STGPROCESSED = 1 AND STGSTMP <= (CURRENT TIMESTAMP - (? DAYS)) no yes


Store

Object name Object type Sequence SQL Statement namearg daysarg
store specified 1 delete from storeent where storeent_id = ? and type='S' yes no

Object name Object type Sequence SQL Statement namearg daysarg
store markedfordelete 1 select directory from store where store_id in (select storeent_id from storeent where markfordelete=1) no no
store markedfordelete 2 select substr(filepath,1,length(rtrim(filepath))-length(rtrim(filename))-1) from fileupload where store_id in (select storeent_id from storeent where markfordelete=1) no no
store markedfordelete 3 delete from storeent where markfordelete=1 no no


Subscriptions

Object name Object type Sequence SQL Statement namearg daysarg
subscription expired_timebased_subscr 1 delete from subscription where (days(current timestamp) - days(lastupdate)) >= ? and subscptype_id='TIME-BASED' and status =2 no yes

Object name Object type Sequence SQL Statement namearg daysarg
subscription canceled_timebased_subscr 1 delete from subscription where (days(current timestamp) - days(lastupdate)) >= ? and subscptype_id='TIME-BASED' and status=3 no yes

Object name Object type Sequence SQL Statement namearg daysarg
subscription expired_recOrder 1 delete from subscription where (days(current timestamp) - days(lastupdate)) >= ? and subscptype_id='NONE' and status =2 no yes

Object name Object type Sequence SQL Statement namearg daysarg
subscription canceled_recOrder 1 delete from subscription where (days(current timestamp) - days(lastupdate)) >= ? and subscptype_id='NONE' and status =3 no yes


Tickler

Object name Object type Sequence SQL Statement namearg daysarg
tickler obsolete 1 delete from tickler where (days(current timestamp) - days(lastupdate)) >= ? and status = 1 no yes


Users

Object name Object type Sequence SQL Statement namearg daysarg
user guest 2 delete from member where member_id in (select users_id from users T1 where registertype='G' and (days(CURRENT TIMESTAMP) - days(prevlastsession)) >= ? And not Exists (select 1 from orders where orders.member_id=T1.users_id and status != 'Q') and (users_id > 0)) no yes

Object name Object type Sequence SQL Statement namearg daysarg
user registered 1 select attachmenturl from attachment where cast(attachment_id as char(60)) != cast(attachmenturl as char(254)) and member_id in (select users_id from users where registertype= 'R' and (days(CURRENT TIMESTAMP) - days(lastsession)) >= ? and (users_id not in (select member_id from orders where status != 'Q')) and (users_id > 0) and (users_id not in (select member_id from address where address_id in (select address_id from orderitems where address_id is not null and status != 'Q') or address_id in (select allocaddress_id from orderitems where allocaddress_id is not null and status != 'Q') or address_id in (select address_id from orders where address_id is not null and status !='Q')))) no yes
user registered 2 delete from member where member_id in (select users_id from users where registertype= 'R' and (days(CURRENT TIMESTAMP) - days(lastsession)) >= ? and (users_id not in (select member_id from orders where status != 'Q')) and (users_id > 0) and (users_id not in (select member_id from address where address_id in (select address_id from orderitems where address_id is not null and status != 'Q') or address_id in (select allocaddress_id from orderitems where allocaddress_id is not null and status != 'Q') or address_id in (select address_id from orders where address_id is not null and status !='Q')))) no yes
user registered 3 delete from aprvstatus where flowtype_id in (select flowtype_id from flowtype where identifier = 'UserRegistrationAdd') and entity_id not in (select member_id from member) no no
user registered 4 delete from flinstance where flowtype_id in (select flowtype_id from flowtype where identifier = 'UserRegistrationAdd') and entity_id not in (select member_id from member) no no


User traffic

Object name Object type Sequence SQL Statement namearg daysarg
usrtraffic obsolete 2 delete from usrtraffic where (days(CURRENT TIMESTAMP) - days(stmp)) >= ? no yes


Vendors

Object name Object type Sequence SQL Statement namearg daysarg
vendor obsolete 1 delete from vendor where markfordelete = 1 and vendor_id not in (select distinct vendor_id from ra) and vendor_id not in (select distinct vendor_id from receipt where vendor_id is not null) no no


Workspace

Object name Object type Sequence SQL Statement namearg daysarg
workspace obsolete 10 delete from cmftaskgrp where status in (5, 13) and templatetype = 0 and (promotiondate is null and (days(CURRENT TIMESTAMP) - days(approvedate)) >= ?) no yes
workspace obsolete 20 delete from cmftaskgrp where status in (5, 13) and templatetype = 0 and (promotiondate is not null and (days(CURRENT TIMESTAMP) - GREATEST(days(approvedate), days(promotiondate))) >= ?) no yes
workspace obsolete 30 delete from cmftask T1 where not exists (select 1 from cmftgtskrel T2 where T1.cmftask_id=T2.cmftask_id ) no no
workspace obsolete 40 delete from cmfwkspc T1 where status in (2, 3) and not exists (select 1 from cmfwstgrel T2 where T1.cmfwkspc_id = T2.cmfwkspc_id) no no

Object name Object type Sequence SQL Statement namearg daysarg
workspace canceled 10 delete from cmftaskgrp where status = 6 and templatetype = 0 no no
workspace canceled 20 delete from cmftask T1 where not exists (select 1 from cmftgtskrel T2 where T1.cmftask_id=T2.cmftask_id ) no no
workspace canceled 30 delete from cmfwkspc T1 where status in (2, 3) and not exists (select 1 from cmfwstgrel T2 where T1.cmfwkspc_id = T2.cmfwkspc_id) no no


Related concepts
Database Cleanup utility