Обсуждение: Queries Errors

Поиск
Список
Период
Сортировка

Queries Errors

От
"Carlos Atencio"
Дата:
Hi,

    I've installed Postgres 7.0.3.
    The bug I founded was very weird.

    I've this query that I run in my app. For example, give a list of all s=
ales from all my stores around the country. The query runs very fast and I =
get the result I want. Later, I try to reduce the search and instead of lis=
t all stores, I want to list only one store. The query runs but this time i=
s slower than before (I have the proper indexes in that table). In this cas=
e, we're using the same query but with one more condition.

    I looked at the query with the explain command and I saw that Postgres =
wasn't using the sentence where I ask only for one store. Accidentally, I m=
ade a mistake and wrote the one store sentence twice in that query. My surp=
rise was that the query did work!!!. When the query had the same sentence w=
ritten twice it actually worked fine and it took fewer time than before.

    None has known how to repair this. In some queries, duplicating some se=
nteces makes it work. In other queries, it doesn't.

Please, if you know how to correct this let me know.

Carlos E.Atencio
Caracas-Venezuela

Re: Queries Errors

От
Tom Lane
Дата:
"Carlos Atencio" <catencio@grupozoom.com> writes:
>     I've installed Postgres 7.0.3.

Consider upgrading to something current (7.1.3, or better 7.2 which
should be out Monday).

>     None has known how to repair this. In some queries, duplicating some se=
> nteces makes it work. In other queries, it doesn't.

You're not likely to get useful help without showing us the exact
queries, explain results, and underlying table schemas.

            regards, tom lane