Bug #53553 | "Copying to tmp table" spend a lot time | ||
---|---|---|---|
Submitted: | 11 May 2010 7:14 | Modified: | 11 Jun 2010 14:10 |
Reporter: | Minfeng Zhang | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.1.46 | OS: | Windows (Windows 7 x64) |
Assigned to: | CPU Architecture: | Any |
[11 May 2010 7:14]
Minfeng Zhang
[11 May 2010 8:22]
Valeriy Kravchuk
Please, send the results of EXPLAIN for the problematic query.
[11 May 2010 8:25]
Minfeng Zhang
EXPLAIN result: 1 SIMPLE flows ALL PRIMARY NULL NULL NULL 315800 Using temporary; Using filesort 1 SIMPLE fnodes ref fid,nid fid 4 myoagov.flows.fid 1 Using where; Distinct
[11 May 2010 8:31]
Minfeng Zhang
EXPLAIN result (using PHP4.4.9+MySQL4.0. it's very fast in MySQL4.0) =================================================================== fnodes ALL NULL NULL NULL NULL 321792 Using where; Using temporary; Using filesort flows eq_ref PRIMARY PRIMARY 4 fnodes.fid 1 Using where
[11 May 2010 8:37]
Minfeng Zhang
MySQL 5.1.48 ============ mysql> explain SELECT SQL_CALC_FOUND_ROWS DISTINCT flows.fid, fname, fstarter, fstime, fedays, fstatus, fsteps, ftype, fcjob, fatt FROM flows INNER JO IN fnodes ON ( fnodes.nid <= flows.fstatus +1 AND fnodes.fid = flows.fid ) WHERE fnodes.nmembers LIKE '%,309,%' AND fnodes.nmemleft NOT LIKE '%,309,%' ORDER BY flows.fstime DESC ; +----+-------------+--------+------+---------------+------+---------+-------------------+--------+---------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+--------+------+---------------+------+---------+-------------------+--------+---------------------------------+ | 1 | SIMPLE | flows | ALL | PRIMARY | NULL | NULL | NULL | 315800 | Using temporary; Using filesort | | 1 | SIMPLE | fnodes | ref | fid,nid | fid | 4 | myoagov.flows.fid | 1 | Using where; Distinct | +----+-------------+--------+------+---------------+------+---------+-------------------+--------+---------------------------------+
[11 May 2010 9:14]
Minfeng Zhang
after deleting the index 'fid', 'nid' in table `fnodes`, the query now is fast. so maybe I didn't set index properly, or the way mysql operate on "join" is not so good?
[11 May 2010 14:10]
Valeriy Kravchuk
Having all indexes back in place, had ou tried to run ANALYZE for both table in 5.1.x before EXPLAIN? I wonder if wrong/outdated statistics can be the reason of this problem.
[11 Jun 2010 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".