Queries Errors - Mailing list pgsql-bugs

From Carlos Atencio
Subject Queries Errors
Date
Msg-id 00cd01c1a916$5f6e18b0$f50010ac@catencio2
Whole thread Raw
Responses Re: Queries Errors
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Corey Huinker
Date:
Subject: optimizer fails to find indexes
Next
From: "Michaele Holtman"
Date:
Subject: initdb problems