查詢正在執行的SQL
SELECT
procpid,
start,
now() - start AS lap,
current_query
FROM
(SELECT
backendid,
pg_stat_get_backend_pid(S.backendid) AS procpid,
pg_stat_get_backend_activity_start(S.backendid) AS start,
pg_stat_get_backend_activity(S.backendid) AS current_query
FROM
(SELECT pg_stat_get_backend_idset() AS backendid) AS S
) AS S
WHERE
current_query <> '<IDLE>'
ORDER BY
lap DESC;
------------------------------------------------------------------------------------------------
刪除表中所有數據(同mysql)
delete from tablename --寫入日誌
Truncate Table tablename --不寫入日誌
------------------------------------------------------------------------------------------------
創建用戶
create user xxx with password 'xxxxxx';
更改用戶密碼
alter user xxx with password 'yyyy';
------------------------------------------------------------------------------------------------
更改表名稱
alter table smallint rename to integer;
更改表列名
alter table integer rename column id to id1;
------------------------------------------------------------------------------------------------
顯示日期
show datestyle;