lundi 31 août 2015

Is the order of comparisant important in a join query?

I usually code a join query as follows:

Select 'field' from 'table' join 'references' on 'table'.'id' = 'references'.'reference'

Now suddenly I wondered, does the order in which you do on 'table'.'id' = 'references'.'reference' have an impact on execution speed or not?

I mainly use sqlserver, mysql and sqlite and I can imagine there might be different implementations in those three if there is a difference at all.

So basically it boils down to:

is on 'table'.'id' = 'references'.'reference' different from on 'references'.'reference' = 'table'.'id'

This question is purely out of curiosity, I'd like to know how it is treated so I can understand it better.

Aucun commentaire:

Enregistrer un commentaire