Announcement

Announcement Module
Collapse
No announcement yet.

index merge union not used in a left join?

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • index merge union not used in a left join?

    Hello,

    I have 2 tables, object and object_link and 2 ways of linking object with another object:
    via the idobject_parent field or via the object_link table.

    here is the request (really simplified):


    SELECT t1.*, t2.*FROM object AS t1 LEFT JOIN object_link AS OL2 ON (OL2.idobject = t1.idobject AND OL2.idobject_link_type = 13 ) LEFT JOIN object AS t2 ON (t2.idobject_parent = t1.idobject OR t2.idobject = OL2.idobject_linked )WHERE t1.idobject_parent = 3371


    here the explain :


    *************************** 1. row *************************** id: 1 select_type: SIMPLE table: t1 type: refpossible_keys: object_index_idobject_parent key: object_index_idobject_parent key_len: 4 ref: const rows: 20 Extra:*************************** 2. row *************************** id: 1 select_type: SIMPLE table: OL2 type: refpossible_keys: PRIMARY,idobject_target key: PRIMARY key_len: 4 ref: t1.idobject rows: 1 Extra: Using index*************************** 3. row *************************** id: 1 select_type: SIMPLE table: t2 type: ALLpossible_keys: PRIMARY,object_index_idobject_parent key: NULL key_len: NULL ref: NULL rows: 89059 Extra:3 rows in set, 1 warning (0.05 sec)-----------


    the third row shows that it doesn't use any key.
    I though it should use a index merge union.

    shouldn't it?

    thank you.

    Christian.
Working...
X