| От | Tom Lane |
|---|---|
| Тема | Re: Problem with SQL query (eats swap) |
| Дата | |
| Msg-id | 2538.966009235@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Problem with SQL query (eats swap) (pgsql-sql@ruby.sartorelli.gen.nz (Mailing List Expander)) |
| Список | pgsql-sql |
pgsql-sql@ruby.sartorelli.gen.nz (Mailing List Expander) writes:
> select count(*) from attachments a where a.id in (select m.id from
> mail m where m.date < now()-62);
> but ran out of swap.
The problem is that "now()-62" leaks memory to the tune of a few dozen
bytes per evaluation. In existing releases that memory won't be
reclaimed till end of query. (This problem is fixed for 7.1, but that
won't help you today.) Since the inner select is re-executed for each
iteration of the outer select, you have a lot of executions of the
inner WHERE clause, and so even a small leak is a problem.
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера