EXPLAIN ANALYZE CREATE TABLE IF NOT EXISTS id_1000_t AS SELECT id, data1 FROM base WHERE id <= 1000; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------- Bitmap Heap Scan on base (cost=653.40..1654.25 rows=36788 width=12) (actual time=0.062..0.556 rows=1000 loops=1) Recheck Cond: (id <= 1000) Heap Blocks: exact=6 -> Bitmap Index Scan on base_pkey (cost=0.00..644.20 rows=36788 width=0) (actual time=0.046..0.047 rows=1000 loops=1) Index Cond: (id <= 1000) Planning Time: 0.135 ms Execution Time: 1.836 ms (7 rows) EXPLAIN ANALYZE CREATE TABLE IF NOT EXISTS id_1000_t AS SELECT id, data1 FROM base WHERE id <= 1000; psql:test.sql:8: ERROR: relation "id_1000_t" already exists [ec2-user@ip-10-0-1-10 create_table_as]$
EXPLAIN ANALYZE CREATE TABLE IF NOT EXISTS id_1000_t AS SELECT id, data1 FROM base WHERE id <= 1000; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------- Bitmap Heap Scan on base (cost=653.40..1654.25 rows=36788 width=12) (actual time=0.060..0.549 rows=1000 loops=1) Recheck Cond: (id <= 1000) Heap Blocks: exact=6 -> Bitmap Index Scan on base_pkey (cost=0.00..644.20 rows=36788 width=0) (actual time=0.044..0.045 rows=1000 loops=1) Index Cond: (id <= 1000) Planning Time: 0.142 ms Execution Time: 1.897 ms (7 rows) EXPLAIN ANALYZE CREATE TABLE IF NOT EXISTS id_1000_t AS SELECT id, data1 FROM base WHERE id <= 1000; psql:test.sql:8: NOTICE: relation "id_1000_t" already exists, skipping QUERY PLAN ------------ (0 rows)
11:14:06 AM JST (every 3s) now ------------------------------- 2021-09-08 11:14:06.704349+09 (1 row) psql:timeout-test.sql:5: FATAL: terminating connection due to idle-session timeout server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. psql:timeout-test.sql:5: fatal: connection to server was lost [ec2-user@ip-10-0-1-10 idle-session-timeout]$ psql の \watch によって 3 秒待つ。 idle 状態が 3 秒以上になるので idle-session timeout となり セッションが切断される
aid, b.bid FROM pgbench_accounts JOIN pgbench_branches USING (bid) AS b WHERE b.bid = 1 ; ERROR: syntax error at or near "AS" LINE 3: USING (bid) AS b ^ testdb=# testdb=# SELECT aid, b.bid FROM pgbench_accounts JOIN pgbench_branches USING (bid) AS b WHERE b.bid = 1 ; aid | bid --------+----- 14702 | 1 6894 | 1 6895 | 1 • PostgreSQL 13 • PostgreSQL 14