mysql> explain SELECT COUNT(*) FROM node n WHERE language != ''; +----+-------------+-------+------+---------------+------+---------+------+---------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+------+---------------+------+---------+------+---------+-------------+ | 1 | SIMPLE | n | ALL | NULL | NULL | NULL | NULL | 3901948 | Using where | +----+-------------+-------+------+---------------+------+---------+------+---------+-------------+ 1 row in set (0.00 sec) mysql> alter table node add index language_idx (language); Query OK, 3901948 rows affected (32 min 11.43 sec) Records: 3901948 Duplicates: 0 Warnings: 0 mysql> explain SELECT COUNT(*) FROM node n WHERE language != ''; +----+-------------+-------+-------+---------------+--------------+---------+------+---------+--------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+-------+---------------+--------------+---------+------+---------+--------------------------+ | 1 | SIMPLE | n | index | language_idx | language_idx | 38 | NULL | 3901948 | Using where; Using index | +----+-------------+-------+-------+---------------+--------------+---------+------+---------+--------------------------+ 1 row in set (0.00 sec)
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | node-language-index.patch | 695 bytes | robertdouglass |
| #3 | node-language-index.patch | 722 bytes | robertdouglass |
Comments
Comment #1
robertdouglass commentedYes, I filed the same issue twice in one week. http://drupal.org/node/375064
Comment #2
robertdouglass commentedThis issue has the clearer title.
Comment #3
robertdouglass commentedI assume we'll follow the "commit to D7 and backport to D6 when we can deal with duplicate indexes" strategy.
Comment #4
damien tournoud commentedThis is pretty straightforward, lets just make a patch for D6 and apply on both branches at the same time. Could you please reroll using a _6xxx update function?
Comment #5
damien tournoud commentedThe node overview filter is generated this way:
And $key in status can be promote, status and sticky.
How could we optimize all those different queries?
Comment #6
robertdouglass commentedDamien, based on the other index patch recently I was under the impression that we're waiting on a db_index_exists() strategy: http://drupal.org/node/363262#comment-1219299
Here's a D6 patch.
Comment #7
robertdouglass commentedComment #8
robertdouglass commentedI combined this fix with another index that affects the same page over here: http://drupal.org/node/373897#comment-1260644
Thus marking as duplicate. Damien, we still need to address your question from http://drupal.org/node/374035#comment-1260563.
Comment #9
damien tournoud commented@Robert: for D7, we have come up with the "upgrades from a development version to another are not supported" rule just because we want to be able to refactor and clean-up update functions at any time.
The upgrade path from D5 to D6 is horribly slow because we haven't done this previously, and as a result, Drupal a few times create an index in an update function just to drop some update functions later.
Comment #10
damien tournoud commentedCross posted with Robert.
Comment #11
samircej commented#3: node-language-index.patch queued for re-testing.
Comment #12
amateescu commentedWhy the re-test?