SET TIME ZONE性能瓶颈 - Django / PostgreSQL

时间:2014-03-20 05:52:50

标签: python django postgresql

我在Django,Postgres(Apache / mod_wsgi背后的一切,在localhost上)都有奇怪的问题。我正在记录慢查询和...

Mar 19 12:58:40 postgres[67952]: [2-1] LOG:  duration: 463.318 ms  statement: SET TIME ZONE 'Europe/Warsaw'
Mar 19 12:59:39 postgres[68226]: [2-1] LOG:  duration: 185.852 ms  statement: SET TIME ZONE 'Europe/Warsaw'
Mar 19 12:59:39 postgres[68225]: [2-1] LOG:  duration: 210.855 ms  statement: SET TIME ZONE 'Europe/Warsaw'
Mar 19 13:01:35 postgres[69228]: [2-1] LOG:  duration: 750.590 ms  statement: SET TIME ZONE 'Europe/Warsaw'
Mar 19 13:01:35 postgres[69226]: [2-1] LOG:  duration: 929.498 ms  statement: SET TIME ZONE 'Europe/Warsaw'
Mar 19 13:01:35 postgres[69229]: [2-1] LOG:  duration: 564.982 ms  statement: SET TIME ZONE 'Europe/Warsaw'
Mar 19 13:01:35 postgres[69227]: [2-1] LOG:  duration: 836.731 ms  statement: SET TIME ZONE 'Europe/Warsaw'
Mar 19 13:03:32 postgres[69819]: [2-1] LOG:  duration: 184.691 ms  statement: SET TIME ZONE 'Europe/Warsaw'
Mar 19 13:04:59 postgres[70442]: [2-1] LOG:  duration: 115.525 ms  statement: SET TIME ZONE 'Europe/Warsaw'

这样的基本命令如何花费这么多时间?某种启动连接问题?

1 个答案:

答案 0 :(得分:0)

我不确定为什么连接开销如此之高,但在我添加CONN_MAX_AGE(Django 1.6)并将其设置为None(持久连接)问题消失后。