Long-running query blocks all other queries

Поиск
Список
Период
Сортировка
От Anton V. Belyaev
Тема Long-running query blocks all other queries
Дата
Msg-id 7363f175-77e4-4f82-94d1-360ab9d77a6f@w34g2000yqm.googlegroups.com
обсуждение исходный текст
Ответы Re: Long-running query blocks all other queries  (Bill Moran <wmoran@potentialtech.com>)
Re: Long-running query blocks all other queries  (Scott Marlowe <scott.marlowe@gmail.com>)
Список pgsql-general
Hello,

I want to run a long running query in background to collect
statistics. I.e. how many users played the game last month more than
50 times.

SELECT count(*) FROM (SELECT user_id, COUNT(*) AS total_games FROM
games, game2user WHERE games.finished > '2009-02-19' AND games.id =
game2user.game_id GROUP BY user_id) AS aaa WHERE aaa.total_games > 50;

I have 4-cored machine, so I expected the query to be able to run for
a long time without performance degrade for application.

But the query has completely blocked all other queries. Even those,
which are not related to tables, used by the long-running query.

Why does this block happen and how to aid it?

Thanks.

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

Предыдущее
От: "Rob Richardson"
Дата:
Сообщение: Changing pg_type records
Следующее
От: Bill Moran
Дата:
Сообщение: Re: Long-running query blocks all other queries