Improved eval monitor sql queries
Review Request #24 - Created Nov. 14, 2008 and discarded
Information | |
---|---|
Valentin Stanciu | |
infoarena | |
Reviewers | |
hackers | |
Optimized monitor queries when there are are only filters related to `ia_job` table. Did this by doing a simple query on the job table with filters and limits and then joining it with the other tables. This is a major improvement, as mysql will parse all entities in a table until it reaches the limits when there are left joins. Going to last page of the eval monitor led to parsing the whole table, even if it's indexed or there's a limit in the query
We should test this with combinations of queries with limits and filters related only to job table or any table. I only did tests to check if it works correctly, some statistics with improvements would be nice.
-
/trunk/common/db/job.php (Diff revision 3) -
I think it would be better if we did a SELECT here to get the user id for a username and then we wouldn't need a join for this. The way it is now I don't think monitor?user=x&first_entry=100000 would be a fast query.
-
/trunk/common/db/job.php (Diff revision 3) -
We should put all these data fields into a separate $fields variable from the queries, so we don't have duplicates.
Review request changed
Change Summary:
Optimized the query with a filter by username as sugested by bogdan and restructured code layout. Hope the code is clear.
Diff: |
Revision 4 (+161 -83) |
---|
Review request changed
Description: |
|
---|
Looks fine to me, except a "query =" instead of "query .=" and some whitespace changes.
-
/trunk/common/db/job.php (Diff revision 4) -
Whitespace.
-
/trunk/common/db/job.php (Diff revision 4) -
$query .= ...
-
/trunk/common/db/job.php (Diff revision 4) -
Whitespace.
-
/trunk/common/db/job.php (Diff revision 4) -
Whitespace.
-
/trunk/common/db/job.php (Diff revision 4) -
Empty line.