pgAdmin 在任何遠端操作上都非常慢
我從遠端連接到我們的開發伺服器的本地 pgAdmin 執行此查詢:
select * from users order by random() limit 1;
它掛起17秒並顯示
Total query runtime: 148 ms. 1 row retrieved.
它還掛在任何操作上:甚至右鍵點擊表格。
之後我通過 RDP 連接並在相同的 pgAdmin 版本中執行相同的查詢,該版本立即顯示結果
query time: 32 ms
。然後我再次從本地 pgAdmin 執行查詢:
Total query runtime: 337 ms. 1 row retrieved.
我有 130 毫秒 ping 到伺服器。連接速度應該綽綽有餘,因為我可以通過 FTP 上傳文件非常快。
使用我的本地 psql 執行時,相同的查詢會在幾秒鐘內完成,包括連接時間。
我的本地 pgAdmin 中的相同查詢與我的本地數據庫副本也立即完成。
pgAdmin 版本是 1.20.0。還檢查了最新的 1.22 - 仍然相同。
我可以做些什麼來加快 pgAdmin?
請注意 psql 工作正常,我沒有看到相同的延遲。
pgAdmin 日誌 17 秒查詢執行:
2016-02-06 16:18:03 INFO : queueing : select * from users order by random() limit 1; 2016-02-06 16:18:03 QUERY : Thread executing query (1:server): select * from users order by random() limit 1; 2016-02-06 16:18:03 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:03 QUERY : Query result: integer 2016-02-06 16:18:03 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:03 QUERY : Query result: 23 2016-02-06 16:18:03 QUERY : Scalar query (server): SELECT format_type(oid,259) as typname FROM pg_type WHERE oid = 1043 2016-02-06 16:18:03 QUERY : Query result: character varying(255) 2016-02-06 16:18:03 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1043 2016-02-06 16:18:03 QUERY : Query result: 1043 2016-02-06 16:18:03 QUERY : Scalar query (server): SELECT format_type(oid,259) as typname FROM pg_type WHERE oid = 1043 2016-02-06 16:18:03 QUERY : Query result: character varying(255) 2016-02-06 16:18:03 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1043 2016-02-06 16:18:03 QUERY : Query result: 1043 2016-02-06 16:18:03 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:04 QUERY : Query result: integer 2016-02-06 16:18:04 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:04 QUERY : Query result: 23 2016-02-06 16:18:04 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:04 QUERY : Query result: integer 2016-02-06 16:18:04 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:04 QUERY : Query result: 23 2016-02-06 16:18:04 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 1114 2016-02-06 16:18:04 QUERY : Query result: timestamp without time zone 2016-02-06 16:18:04 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1114 2016-02-06 16:18:04 QUERY : Query result: 1114 2016-02-06 16:18:04 QUERY : Scalar query (server): SELECT format_type(oid,0) as typname FROM pg_type WHERE oid = 1114 2016-02-06 16:18:04 QUERY : Query result: timestamp(0) without time zone 2016-02-06 16:18:04 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1114 2016-02-06 16:18:04 QUERY : Query result: 1114 2016-02-06 16:18:04 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:05 QUERY : Query result: integer 2016-02-06 16:18:05 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:06 QUERY : Query result: 23 2016-02-06 16:18:06 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:06 QUERY : Query result: integer 2016-02-06 16:18:06 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:06 QUERY : Query result: 23 2016-02-06 16:18:06 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:07 QUERY : Query result: integer 2016-02-06 16:18:07 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:07 QUERY : Query result: 23 2016-02-06 16:18:07 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 16 2016-02-06 16:18:07 QUERY : Query result: boolean 2016-02-06 16:18:07 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=16 2016-02-06 16:18:07 QUERY : Query result: 16 2016-02-06 16:18:07 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 20 2016-02-06 16:18:07 QUERY : Query result: bigint 2016-02-06 16:18:07 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=20 2016-02-06 16:18:07 QUERY : Query result: 20 2016-02-06 16:18:07 QUERY : Scalar query (server): SELECT format_type(oid,259) as typname FROM pg_type WHERE oid = 1043 2016-02-06 16:18:07 QUERY : Query result: character varying(255) 2016-02-06 16:18:07 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1043 2016-02-06 16:18:08 QUERY : Query result: 1043 2016-02-06 16:18:08 QUERY : Scalar query (server): SELECT format_type(oid,259) as typname FROM pg_type WHERE oid = 1043 2016-02-06 16:18:08 QUERY : Query result: character varying(255) 2016-02-06 16:18:08 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1043 2016-02-06 16:18:08 QUERY : Query result: 1043 2016-02-06 16:18:08 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 1114 2016-02-06 16:18:08 QUERY : Query result: timestamp without time zone 2016-02-06 16:18:08 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1114 2016-02-06 16:18:08 QUERY : Query result: 1114 2016-02-06 16:18:08 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:08 QUERY : Query result: integer 2016-02-06 16:18:08 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:08 QUERY : Query result: 23 2016-02-06 16:18:08 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:09 QUERY : Query result: integer 2016-02-06 16:18:09 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:09 QUERY : Query result: 23 2016-02-06 16:18:09 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 16 2016-02-06 16:18:09 QUERY : Query result: boolean 2016-02-06 16:18:09 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=16 2016-02-06 16:18:09 QUERY : Query result: 16 2016-02-06 16:18:09 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:09 QUERY : Query result: integer 2016-02-06 16:18:09 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:09 QUERY : Query result: 23 2016-02-06 16:18:09 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:09 QUERY : Query result: integer 2016-02-06 16:18:09 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:09 QUERY : Query result: 23 2016-02-06 16:18:09 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 16 2016-02-06 16:18:10 QUERY : Query result: boolean 2016-02-06 16:18:10 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=16 2016-02-06 16:18:10 QUERY : Query result: 16 2016-02-06 16:18:10 QUERY : Scalar query (server): SELECT format_type(oid,259) as typname FROM pg_type WHERE oid = 1043 2016-02-06 16:18:10 QUERY : Query result: character varying(255) 2016-02-06 16:18:10 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1043 2016-02-06 16:18:10 QUERY : Query result: 1043 2016-02-06 16:18:11 QUERY : Scalar query (server): SELECT format_type(oid,259) as typname FROM pg_type WHERE oid = 1043 2016-02-06 16:18:11 QUERY : Query result: character varying(255) 2016-02-06 16:18:11 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1043 2016-02-06 16:18:11 QUERY : Query result: 1043 2016-02-06 16:18:11 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 1114 2016-02-06 16:18:11 QUERY : Query result: timestamp without time zone 2016-02-06 16:18:11 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1114 2016-02-06 16:18:12 QUERY : Query result: 1114 2016-02-06 16:18:12 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 1114 2016-02-06 16:18:12 QUERY : Query result: timestamp without time zone 2016-02-06 16:18:12 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1114 2016-02-06 16:18:12 QUERY : Query result: 1114 2016-02-06 16:18:12 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 1114 2016-02-06 16:18:12 QUERY : Query result: timestamp without time zone 2016-02-06 16:18:12 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1114 2016-02-06 16:18:12 QUERY : Query result: 1114 2016-02-06 16:18:12 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 16 2016-02-06 16:18:12 QUERY : Query result: boolean 2016-02-06 16:18:12 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=16 2016-02-06 16:18:12 QUERY : Query result: 16 2016-02-06 16:18:12 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:12 QUERY : Query result: integer 2016-02-06 16:18:12 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:13 QUERY : Query result: 23 2016-02-06 16:18:13 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:13 QUERY : Query result: integer 2016-02-06 16:18:13 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:13 QUERY : Query result: 23 2016-02-06 16:18:13 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 16 2016-02-06 16:18:13 QUERY : Query result: boolean 2016-02-06 16:18:13 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=16 2016-02-06 16:18:13 QUERY : Query result: 16 2016-02-06 16:18:13 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:13 QUERY : Query result: integer 2016-02-06 16:18:13 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:13 QUERY : Query result: 23 2016-02-06 16:18:13 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:13 QUERY : Query result: integer 2016-02-06 16:18:13 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:14 QUERY : Query result: 23 2016-02-06 16:18:14 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 16 2016-02-06 16:18:14 QUERY : Query result: boolean 2016-02-06 16:18:14 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=16 2016-02-06 16:18:14 QUERY : Query result: 16 2016-02-06 16:18:14 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:14 QUERY : Query result: integer 2016-02-06 16:18:14 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:14 QUERY : Query result: 23 2016-02-06 16:18:14 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 1114 2016-02-06 16:18:15 QUERY : Query result: timestamp without time zone 2016-02-06 16:18:15 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1114 2016-02-06 16:18:15 QUERY : Query result: 1114 2016-02-06 16:18:15 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:15 QUERY : Query result: integer 2016-02-06 16:18:15 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:16 QUERY : Query result: 23 2016-02-06 16:18:16 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:16 QUERY : Query result: integer 2016-02-06 16:18:16 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:16 QUERY : Query result: 23 2016-02-06 16:18:16 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:16 QUERY : Query result: integer 2016-02-06 16:18:16 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:16 QUERY : Query result: 23 2016-02-06 16:18:16 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:16 QUERY : Query result: integer 2016-02-06 16:18:16 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:16 QUERY : Query result: 23 2016-02-06 16:18:16 QUERY : Scalar query (server): SELECT format_type(oid,259) as typname FROM pg_type WHERE oid = 1043 2016-02-06 16:18:17 QUERY : Query result: character varying(255) 2016-02-06 16:18:17 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1043 2016-02-06 16:18:17 QUERY : Query result: 1043 2016-02-06 16:18:17 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:17 QUERY : Query result: integer 2016-02-06 16:18:17 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:17 QUERY : Query result: 23 2016-02-06 16:18:17 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 16 2016-02-06 16:18:17 QUERY : Query result: boolean 2016-02-06 16:18:17 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=16 2016-02-06 16:18:17 QUERY : Query result: 16 2016-02-06 16:18:17 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:17 QUERY : Query result: integer 2016-02-06 16:18:17 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:18 QUERY : Query result: 23 2016-02-06 16:18:18 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:18 QUERY : Query result: integer 2016-02-06 16:18:18 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:18 QUERY : Query result: 23 2016-02-06 16:18:18 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:18 QUERY : Query result: integer 2016-02-06 16:18:18 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:18 QUERY : Query result: 23 2016-02-06 16:18:18 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 1114 2016-02-06 16:18:18 QUERY : Query result: timestamp without time zone 2016-02-06 16:18:18 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1114 2016-02-06 16:18:18 QUERY : Query result: 1114 2016-02-06 16:18:18 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 23 2016-02-06 16:18:18 QUERY : Query result: integer 2016-02-06 16:18:18 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=23 2016-02-06 16:18:19 QUERY : Query result: 23 2016-02-06 16:18:19 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 16 2016-02-06 16:18:19 QUERY : Query result: boolean 2016-02-06 16:18:19 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=16 2016-02-06 16:18:19 QUERY : Query result: 16 2016-02-06 16:18:19 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 16 2016-02-06 16:18:19 QUERY : Query result: boolean 2016-02-06 16:18:19 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=16 2016-02-06 16:18:19 QUERY : Query result: 16 2016-02-06 16:18:19 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 1114 2016-02-06 16:18:19 QUERY : Query result: timestamp without time zone 2016-02-06 16:18:19 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1114 2016-02-06 16:18:19 QUERY : Query result: 1114 2016-02-06 16:18:19 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 20 2016-02-06 16:18:19 QUERY : Query result: bigint 2016-02-06 16:18:19 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=20 2016-02-06 16:18:20 QUERY : Query result: 20 2016-02-06 16:18:20 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 16 2016-02-06 16:18:20 QUERY : Query result: boolean 2016-02-06 16:18:20 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=16 2016-02-06 16:18:20 QUERY : Query result: 16 2016-02-06 16:18:20 QUERY : Scalar query (server): SELECT format_type(oid,-1) as typname FROM pg_type WHERE oid = 1114 2016-02-06 16:18:20 QUERY : Query result: timestamp without time zone 2016-02-06 16:18:20 QUERY : Scalar query (server): SELECT CASE WHEN typbasetype=0 THEN oid else typbasetype END AS basetype FROM pg_type WHERE oid=1114 2016-02-06 16:18:20 QUERY : Query result: 1114
摘自
pgadmin.log
顯示,對於結果的每個輸出列,pgadmin
對目錄執行兩個查詢,一個從其獲取類型的格式化名稱oid
,另一個獲取潛在的基本類型。在您的摘錄中,如果我數正確的話,此類查詢的總數似乎是
106
.從 的 ping 時間
148 ms
,我們假設往返伺服器的最短時間是148 ms
。所以這組查詢所花費的最短時間是148 x 106 = 15688 ms
, 或15.6 s
另一方面,命令行
psql
客戶端不執行任何這些查詢,因此可以預期它至少15.6
在 pgadmin 之前完成了幾秒鐘。我不知道 pgadmin 中有任何選項可以禁用它,您可能想詢問開發人員或檢查您是否擁有最新版本,但去年在郵件列表中提出了與您類似的問題,顯然沒有回复:
長查詢結果呈現(在 pgadmin-support 檔案中)。
這是 pgAdmin 中令人失望的實現細節。它可以通過單個查詢獲得所有結果,其中 OID 類型列表在
IN(...)
構造或數組中傳遞。它還可以記憶體這些結果,甚至不會對它已經看到的 OID 重複查詢。