Re: Query much slower from php than psql or dbeaver

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Query much slower from php than psql or dbeaver
Дата
Msg-id 891559.1642701617@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Query much slower from php than psql or dbeaver  (Ekaterina Amez <ekaterina.amez@zunibal.com>)
Ответы Re: Query much slower from php than psql or dbeaver  (Michael Lewis <mlewis@entrata.com>)
Список pgsql-general
Ekaterina Amez <ekaterina.amez@zunibal.com> writes:
> I've tested the query with psql and DBeaver and it takes only milliseconds:
> it returns 39 records and now there's only 16000 records on the table but
> I've tested it with <100K. When I've tested my php script the same query
> takes 14 minutes to return (more or less).

A plausible theory is that it's not really the same query, but differs
in having some values presented as parameters not literal constants.
Depending on exactly how you do it, that can confuse the planner
leading to a poor execution plan and a long runtime.

I'd first try enabling log_statement on the server to see if the
query is really being presented exactly the same way.  Another
thing worth trying is auto_explain, to capture the plans actually
being used.

            regards, tom lane



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

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: psql does not provide proper response
Следующее
От: Garfield Lewis
Дата:
Сообщение: Re: [EXT] Re: Can we get the CTID value