Re: BUG #1473: Backend bus error, possibly due to ANALYZE

Поиск
Список
Период
Сортировка
От John Hansen
Тема Re: BUG #1473: Backend bus error, possibly due to ANALYZE
Дата
Msg-id 5066E5A966339E42AA04BA10BA706AE56246@rodrick.geeknet.com.au
обсуждение исходный текст
Ответ на BUG #1473: Backend bus error, possibly due to ANALYZE  ("Brian B." <brian-pgsql@bbdab.org>)
Список pgsql-bugs
> It seems what's happening here is that dspam is submitting a=20
> query with many thousands of elements in the IN clause. In=20
> the parser, we transform "foo IN (a, b, c)" into "foo =3D a OR=20
> foo =3D b OR foo =3D c", and then recurse for each element of the=20
> OR expression and eventually run out of stack space. (Note=20
> that this will actually be worse in HEAD, since a refactoring=20
> I applied will mean we consume two stack frames for each
> expression.)
>=20
> A workaround would be to increase PostgreSQL's stack size.
>=20
> Perhaps it would be worth considering representing IN lists=20
> as a distinct expression type, at least in the parser. Then the
> transformExpr() code would look like:

Just like I showed earlier on large IN () lists are useless....
Instead I use the UNNEST function I posted earlier (see http://archives.pos=
tgresql.org/pgsql-hackers/2004-11/msg00327.php) like so:

Select id from table inner join unnest(array[1,2,3,4,...]) as d(id) using(i=
d);

Not only does it not crash the backend,. But it also proved to be faster, t=
ho admittedly not much.


... John

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

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: BUG #1473: Backend bus error, possibly due to ANALYZE
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: 8.0 ecpg crashes with "create table as" statement.