Uruchamiam to zapytanie z mojego lokalnego pgAdmin łączącego się zdalnie z naszym serwerem deweloperskim:
select * from users order by random() limit 1;
zawiesza się przez 17 sekund i pokazuje
Total query runtime: 148 ms.
1 row retrieved.
wisi także na dowolnej operacji: nawet kliknięciu prawym przyciskiem myszy na stole.
Następnie łączę się przez RDP i uruchamiam tam to samo zapytanie w tej samej wersji pgAdmin, która natychmiast wyświetla wyniki query time: 32 ms
.
Następnie ponownie uruchamiam zapytanie z mojego lokalnego pgAdmin:
Total query runtime: 337 ms.
1 row retrieved.
Mam ping do 130 ms na serwer. Szybkość połączenia powinna być więcej niż wystarczająca, ponieważ mogę tam przesyłać pliki przez FTP dość szybko.
To samo zapytanie uruchomione z moim lokalnym PSQL kończy się w ciągu kilku sekund z uwzględnieniem czasu połączenia.
To samo zapytanie w moim lokalnym pgAdmin z moją lokalną kopią bazy danych kończy się natychmiast.
Wersja pgAdmin to 1.20.0. Sprawdzone także w najnowszej wersji 1.22 - wciąż to samo.
Co mogę zrobić, aby przyspieszyć pgAdmin?
Pamiętaj, że psql działa dobrze, nie widzę tam takich samych opóźnień.
Dziennik pgAdmin przez 17 sekund uruchamiania zapytania:
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
Odpowiedzi:
Wyciąg z
pgadmin.log
pokazuje, że dla każdej wyjściowej kolumny wynikupgadmin
wykonuje dwa zapytania do katalogu, jedno w celu uzyskania sformatowanej nazwy typu zoid
drugiego, w celu uzyskania potencjalnego typu podstawowego.W twoim wyciągu, jeśli dobrze liczę, łączna liczba takich zapytań wydaje się być
106
.Od czasu pingowania
148 ms
załóżmy, że minimalny czas podróży w obie strony na serwer to148 ms
. Zatem minimalny czas zajęty przez ten zestaw zapytań wynosiłby148 x 106 = 15688 ms
lub15.6 s
Z drugiej strony
psql
klient wiersza poleceń nie wykonuje żadnego z tych zapytań, więc można oczekiwać, że zakończy się co najmniej15.6
kilka sekund przed pgadminem.Nie znam żadnej opcji w pgadmin, aby to wyłączyć, możesz poprosić programistów lub sprawdzić, czy masz najnowszą wersję, ale pytanie podobne do twojego zostało zadane w zeszłym roku na liście mailingowej i najwyraźniej nie otrzymało odpowiedź:
Renderowanie wyników długich zapytań (w archiwum pgadmin-support).
Jest to rozczarowujący szczegół implementacji w pgAdmin. Może uzyskać wszystkie wyniki za pomocą pojedynczego zapytania, z listą typów identyfikatorów OID przekazywanych w
IN(...)
konstrukcji lub tablicy. Może również buforować te wyniki, a nawet nie powtarzać zapytań o identyfikatory OID, które już widział.źródło