Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infinite loop on a sql query [CORE3888] #4225

Closed
firebird-automations opened this issue Jul 12, 2012 · 4 comments
Closed

infinite loop on a sql query [CORE3888] #4225

firebird-automations opened this issue Jul 12, 2012 · 4 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Daniel (danielv8888)

Votes: 1

whit this query
"update full_combin_random c set c.utilise=1 where
http://c.ID in (select http://a.ID from full_combin_random a inner join full_combin b on
b.utilise=1 and
a.A=b.A and
a.B=b.B and
a.C=b.C and
a.D=b.D and
a.E=b.E and
a.F=b.F);"
or
"select c.* from full_combin_random c where
http://c.ID in (select http://a.ID from full_combin_random a inner join full_combin b on
b.utilise=1 and
a.A=b.A and
a.B=b.B and
a.C=b.C and
a.D=b.D and
a.E=b.E and
a.F=b.F);"
i have a infinity loop !
the table "full_combin_randon" contains + - 8000000 million rows,
the table "full_combin" same thing.
the two tables are indexed on fields (a, b, c, d, e, f) and (utilise).
the processor goes up to 99%.
I let the query run two days without results.

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

This is not a engine bug or direct problem, it is simply a poorly written query and/or missing indexes.

Your queries is resulting in 8,000,000^2 rows being read!!!!

The more optimal version of the query would be:

update full_combin_random c set
c.utilise=1
where
EXISTS(
SELECT 1
from full_combin_random a
inner join full_combin b on (
b.utilise=1 and
a.A=b.A and
a.B=b.B and
a.C=b.C and
a.D=b.D and
a.E=b.E and
a.F=b.F
)
WHERE
http://a.ID = http://c.ID
)

The query performance is affected by the use of the IN() instead of EXISTS() and whether there is a compound index A+B+C+D+E+F+utilise on the full_combin table.

The optimization of the query should be discussed in the Firebird Support mailing list (http://groups.yahoo.com/group/firebird-support/) not in this tracker.

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Given the lack of response to the comments, the case is closed. It can be further reviewed in additional comments/details become available.

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant