Need to delete millions of rows from a table fast? Here is how you can do this:
1: ALTER TABLE table_name ACTIVATE NOT LOGGED INITIALLY; –disable logging
2: DELETE FROM table_name WHERE ….;
3: COMMIT; –Commits and enable logging
Need to delete millions of rows from a table fast? Here is how you can do this:
1: ALTER TABLE table_name ACTIVATE NOT LOGGED INITIALLY; –disable logging
2: DELETE FROM table_name WHERE ….;
3: COMMIT; –Commits and enable logging
Here are some very useful utility SQLs that will allow you to understand your space usage, system and other useful stuff:
DB2 Space Usage & Status
1: — to find tablespace status, type , usage run following SQL
2: select substr(tablespace_name,1,20) Tablespace_name,
3: case t.TBSPACETYPE [...]
Some of the processes that depend on shared table instances , can experience a dramatic differences in performance, in case all of the instances available are being used, or remaining locked by some orphan or failed process. One way to resolve this problem is to go online and check if tables should be “released”. Here [...]
Tags: PeopleSoft · Performance · SQL · Tips
Here are a few more nice DB2 scripts that would save you time:
Get all tables in Table Space
– Get all tables in particular tablespaceselect SUBSTR(TABNAME,1,25) "TABNAME", SUBSTR(TABSCHEMA,1,15) "SCHEMA", NPAGES, CARD from syscat.tables where tbspace = ‘?’
Generate Grants for all tables in Table Space
– Genereating GRANTS SELECT ‘grant select on ‘ || tabname || ‘ to [...]