tags:

views:

18

answers:

1

Hello, I've got a bunch of classes that describe database schema: Table,Field,ForeignKey. Tables have ForeignKeys list and Fields list.

Now I would like to generate SELECT statement with all the joins that are described in ForeignKey instances.

The question is: is order of tables relevant for the query time? Another words - do I have to care or is it done automatically for me by the db engine?

+1  A: 

is order of tables relevant for the query time? Another words - do I have to care or is it done automatically for me by the db engine?

To the optimizer, no -- it doesn't matter.

For sake of readability and maintainance, you might want to consider laying the FROM and JOIN clauses out in a manner that reads well. If only dealing with INNER joins, there's no issue but OUTER JOINS I generally define after the FROM clause and use LEFT JOIN syntax exclusively. But that's a matter of style & taste...

OMG Ponies
Thank you. I was interested only in the optimizer part. The rest is rather obvious (at least for me).
kubal5003