List:General Discussion« Previous MessageNext Message »
From:brian Date:July 3 2012 4:28pm
Subject:Re: alternative to slow query
View as plain text  
On 12-07-02 09:33 PM, yoku ts wrote:
> Hello,
>
> add index to expression1_id and expression2_id on expression_expression.
>
> it doesn't use index,following,
>
>> WHERE
>>          ee2.expression1_id = $ID
>> OR
>>          ee1.expression2_id = $ID
>

Thank you for your reply. The table already has indexes on these 
columns, however:

mysql db_lexi > show index from expression_expression\G
*************************** 1. row ***************************
        Table: expression_expression
   Non_unique: 0
     Key_name: PRIMARY
Seq_in_index: 1
  Column_name: id
    Collation: A
  Cardinality: 106191
     Sub_part: NULL
       Packed: NULL
         Null:
   Index_type: BTREE
      Comment:
*************************** 2. row ***************************
        Table: expression_expression
   Non_unique: 1
     Key_name: expression2_id_idx
Seq_in_index: 1
  Column_name: expression2_id
    Collation: A
  Cardinality: 106191
     Sub_part: NULL
       Packed: NULL
         Null:
   Index_type: BTREE
      Comment:
*************************** 3. row ***************************
        Table: expression_expression
   Non_unique: 1
     Key_name: type_lien_id_idx
Seq_in_index: 1
  Column_name: type_lien_id
    Collation: A
  Cardinality: 43
     Sub_part: NULL
       Packed: NULL
         Null: YES
   Index_type: BTREE
      Comment:
*************************** 4. row ***************************
        Table: expression_expression
   Non_unique: 1
     Key_name: expression1_id_idx
Seq_in_index: 1
  Column_name: expression1_id
    Collation: A
  Cardinality: 106191
     Sub_part: NULL
       Packed: NULL
         Null:
   Index_type: BTREE
      Comment:
4 rows in set (0.23 sec)
Thread
alternative to slow querybrian3 Jul
  • Re: alternative to slow queryyoku ts3 Jul
    • Re: alternative to slow querybrian3 Jul
      • RE: alternative to slow queryBenjamin Stillman3 Jul
        • Re: alternative to slow querybrian3 Jul
          • RE: alternative to slow queryBenjamin Stillman3 Jul
            • Re: alternative to slow querybrian3 Jul
              • RE: alternative to slow queryRick James16 Jul
                • Re: alternative to slow querybrian17 Jul