This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ALTER TABLE table_name_1 DISABLE TRIGGER ALL; | |
| ALTER TABLE table_name_2 DISABLE TRIGGER ALL; | |
| DELETE FROM table_name_1 where id=xxx; | |
| DELETE FROM table_name_2 where id=xxx; | |
| ALTER TABLE table_name_1 ENABLE TRIGGER ALL; | |
| ALTER TABLE table_name_2 ENABLE TRIGGER ALL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| delete from table_name a using table_name b | |
| where a.id > b.id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- process exited with code 3221225477 | |
| Open cmd as admin and type diskpart. | |
| Then type list disk. | |
| CTRL + C and close cmd and reopen powershell. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| do $$ | |
| declare col varchar(100); | |
| begin | |
| for col in select column_name from information_schema.columns where column_name!='id' and table_name='table_name' loop | |
| insert into table_name (columns) values (values); | |
| raise notice 'name: %', replace(col, '(', ''); | |
| end loop; | |
| end; $$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Computer Configuration -> Policies -> Windows Settings -> Security Settings -> Local Policies -> Security Options -> Interactive logon: Machine inactivity limit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DO $$ | |
| DECLARE | |
| i TEXT; | |
| BEGIN | |
| FOR i IN ( | |
| SELECT 'SELECT SETVAL(' | |
| || quote_literal(quote_ident(PGT.schemaname) || '.' || quote_ident(S.relname)) | |
| || ', COALESCE(MAX(' ||quote_ident(C.attname)|| '), 1) ) FROM ' | |
| || quote_ident(PGT.schemaname)|| '.'||quote_ident(T.relname)|| ';' | |
| FROM pg_class AS S, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\InactivityTimeoutSecs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- truncate all tables | |
| SELECT 'TRUNCATE ' || input_table_name || ' CASCADE;' AS truncate_query FROM(SELECT table_schema || '.' || table_name AS input_table_name | |
| FROM information_schema.tables | |
| WHERE table_schema NOT IN ('pg_catalog', 'information_schema') AND table_schema NOT LIKE 'pg_toast%') AS information; | |
| -- restart identity columns | |
| SELECT 'TRUNCATE ' || input_table_name || ' RESTART IDENTITY CASCADE;' AS truncate_query FROM(SELECT table_schema || '.' || table_name AS input_table_name | |
| FROM information_schema.tables | |
| WHERE table_schema NOT IN ('pg_catalog', 'information_schema') AND table_schema NOT LIKE 'pg_toast%') AS information; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { IntegrationDataType: "DELVRY03", "RequestData" : { $regex : ".*4502742347.*" }, TimeStamp: { "$gte": ISODate('2020-08-23T00:00:00'), "$lt": ISODate('2020-09-24T00:00:00') } } | |
| { IntegrationDataType: "DELVRY03", "RequestData" : { $regex : ".*4502742347.*" }, TimeStamp: { "$gte": ISODate('2020-08-23T00:00:00'), "$lt": ISODate('2020-09-24T00:00:00') } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- DB SIZE | |
| SELECT pg_size_pretty(pg_database_size('db_name')); | |
| -- TABLE SIZE | |
| SELECT pg_size_pretty(pg_total_relation_size('table_name')); | |
| -- GET ALL TABLE SIZES | |
| SELECT nspname || '.' || relname AS "relation", | |
| pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size" | |
| FROM pg_class C | |
| LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) |