I have the same postgres query running in two different instances restored with the same dump file:
- one instance in aws rds => https://explain.depesz.com/s/USMO ('PostgreSQL 11.10 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11), 64-bit')
- one instance in compute engine vm in gcp => https://explain.depesz.com/s/LTUL ('PostgreSQL 11.10 (Debian 11.10-0+deb10u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit')
But the query in 1) (40s) is faster than 2) (400s) (execution time calculated in python)
What I tried:
- ran without cache (restart the on prem gcp instance)
- changed the where clause values
- ran the query in different computers
- analyze the basics of explain command (same plan and same indexes)
What are the main reasons for this?
My main hypothesis now is the network traffic. How can I test that?
- both have the same postgres version and hardware configuration
- I am not sure, but these times are the first run of each query and cache (maybe) is not involved
- traceroute 1) = 13.864 ms / traceroute 2) = 32.469 ms
14.87 ms
/776.976 ms
. The huge rest of 40s / 400s is outside of Postgres' jurisdiction. Also, Postgres 11 has reached EOL in 2023. Use a current version for your tests. Either way, a multicolumn index on("SignalSettingId", "DateTime")
should help (but not much for the given filter values).