- table 목록 보기
postgresql: \d
postgresql: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';
- db목록 보기
postgresql: \l
postgresql: SELECT datname FROM pg_database;
- 컬럼 내용 보기
postgresql: \d
table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';
- DESCRIBE TABLE
postgresql: \d+
table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table'
- user 정보 보기
select * from pg_user where usename = CURRENT_USER;
- 현재 유저 정보 보기
select CURRENT_USER;
-function 내용보기
SELECT prosrc FROM pg_proc WHERE proname = 'partitioning_trigger_login';
-index 조회하기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | SELECT i.relname as indname, i.relowner as indowner, idx.indrelid::regclass, am.amname as indam, idx.indkey, ARRAY( SELECT pg_get_indexdef(idx.indexrelid, k + 1, true) FROM generate_subscripts(idx.indkey, 1) as k ORDER BY k ) as indkey_names, idx.indexprs IS NOT NULL as indexprs, idx.indpred IS NOT NULL as indpred FROM pg_index as idx JOIN pg_class as i ON i.oid = idx.indexrelid JOIN pg_am as am ON i.relam = am.oid and i.relname not like 'pg%'; |
-컴마 붙이기
select to_char(123456789, 'FM999,999,990');
-index table space 변경
ALTER INDEX tb_ham_log_login_2013_11_first_idx1 SET TABLESPACE tbs_ham