# index merge union not used in a left join?

**URL:** https://forums.percona.com/t/index-merge-union-not-used-in-a-left-join/716
**Category:** Other MySQL® Questions
**Created:** [April 16, 2008, 8:26am UTC](https://forums.percona.com/t/index-merge-union-not-used-in-a-left-join/716 "2008-04-16T08:26:29Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kriks](https://avatars.discourse-cdn.com/v4/letter/k/7ab992/32.png) [@kriks](https://forums.percona.com/u/kriks)
#### Post date: [April 16, 2008, 8:26am UTC](https://forums.percona.com/t/index-merge-union-not-used-in-a-left-join/716/1 "2008-04-16T08:26:29Z")

</div>

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.
