There are some strategic indexes that are not working, making the tables very slow with large joins. This works very well in combination with the previous patch I sent that changes the LEFT JOIN's into INNER JOINS.

Here is the EXPLAINS without and then with the patch:

WITHOUT

mysql> EXPLAIN
    -> SELECT s.sid, s.submitted, s.remote_addr, sd.cid, sd.no, sd.data
    -> FROM webform_submissions as s
    -> LEFT JOIN webform_submitted_data as sd on (sd.sid = s.sid)
    -> WHERE sd.nid = 8012;
+----+-------------+-------+------+---------------+---------+---------+----------------------+-------+-------------+
| id | select_type | table | type | possible_keys | key     | key_len | ref                  | rows  | Extra       |
+----+-------------+-------+------+---------------+---------+---------+----------------------+-------+-------------+
|  1 | SIMPLE      | s     | ALL  | NULL          | NULL    | NULL    | NULL                 | 31667 |             |
|  1 | SIMPLE      | sd    | ref  | PRIMARY       | PRIMARY | 8       | const,stevedev.s.sid |  2952 | Using where |
+----+-------------+-------+------+---------------+---------+---------+----------------------+-------+-------------+

WITH

mysql> EXPLAIN    
    -> SELECT s.sid, s.submitted, s.remote_addr, sd.cid, sd.no, sd.data
    -> FROM webform_submissions as s
    -> LEFT JOIN webform_submitted_data as sd on (sd.sid = s.sid)
    -> WHERE sd.nid = 8012;
+----+-------------+-------+------+---------------+------+---------+-----------------+--------+-------------+
| id | select_type | table | type | possible_keys | key  | key_len | ref             | rows   | Extra       |
+----+-------------+-------+------+---------------+------+---------+-----------------+--------+-------------+
|  1 | SIMPLE      | sd    | ALL  | PRIMARY,sid   | NULL | NULL    | NULL            | 332068 | Using where |
|  1 | SIMPLE      | s     | ref  | sid           | sid  | 4       | stevedev.sd.sid |      1 |             |
+----+-------------+-------+------+---------------+------+---------+-----------------+--------+-------------+

steve

CommentFileSizeAuthor
webform_install_0.patch2.25 KBslantview

Comments

quicksketch’s picture

Rock. Thanks Steve. I've put this into the 5.x dev version of webform and it will make it into 1.3. Thanks!

quicksketch’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)