Re: psql is hanging

Поиск
Список
Период
Сортировка
От Christopher Browne
Тема Re: psql is hanging
Дата
Msg-id CAFNqd5WfhWYzFhdg2iQmNDnBX9V_xyE_Ud8akb=_roGBg8BSfA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: psql is hanging  (John Smith <localdevjs@gmail.com>)
Список pgsql-general
I like the "add an analyze" idea; the two most likely causes of the
phenomenon (to my mind) are either:

a) Something's getting locked and Tom Lane's idea of checking pg_locks
when you notice it's stopped can help track down the problem.

Further to that, the thing I'd be expecting to see if the problem is
locking is that the connection that's blocked up will be waiting on a
lock held by another connection.

It's near certain that you'll find that the connection doing the work
will have LOTS of locks outstanding; that's not a problem at all;
that's perfectly normal.  You need to look keenly for locks that have
not yet been granted.

b) I find it common in my environments to need to do manual ANALYZE
requests all the time because I'll set up temporary tables (that the
autovacuum daemon can't do anything about) which, as the stats are
lacking, will lead to awful query plans that make queries run badly.

If you use temporary tables, that's like a heavy "thumb on the scale"
that can lead to awful performance, unless those tables get an ANALYZE
after getting populated.

Unpredictable slowness can certainly result from tables having changed
size leading to pathological query plans.  ANALYZE will help.


В списке pgsql-general по дате отправления:

Предыдущее
От: Igor Korot
Дата:
Сообщение: Re: How to watch for schema changes
Следующее
От: Glenn Schultz
Дата:
Сообщение: using a function in where