Re: performance issue

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: performance issue
Дата
Msg-id 47EB2E81.3080302@ejurka.com
обсуждение исходный текст
Ответ на performance issue  (Steven varga <varga@yorku.ca>)
Ответы Re: performance issue  (Guillaume Cottenceau <gc@mnc.ch>)
Список pgsql-jdbc
Steven varga wrote:
>
> having about 10^6 records in a table indexed on names and doing a
> query from psql I get response time in millisec order on the other
> hand when executing the same query through JDBC it hangs about 80
> seconds.
>
>  PreparedStatement count =
>         connection.prepareStatement("SELECT count(*) FROM
>     upc WHERE name like upper(?)||'%' ");
>

When using a PreparedStatement the server must come up with a plan that
works for all parameter values.  Since the parameter is unknown, the
generated plan doesn't use an index.  Your options are to interpolate
the parameter yourself or connect using the protocolVersion=2 URL option
which will make the driver do the interpolation prior to passing the
query on to the server.

Kris Jurka

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

Предыдущее
От: Steven varga
Дата:
Сообщение: performance issue
Следующее
От: Guillaume Cottenceau
Дата:
Сообщение: Re: performance issue