Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Driving table in sql

 
Mallika Kumar
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need some clarification. Could someone explain what the Driving table is, and what its significance is? I'm trying to optimize my query....what are the things that I should keep in mind when optimizing ?
As far as I know,a Driving table is the table that is accessed first in a select statement. In the following statement:
SELECT * FROM EMPLOYEE E,ADDRESS A WHERE A.ADDNO = E.ADDNO
Is EMPLOYEE the Driving table, or ADDRESS, ie, the first table in WHERE clause or first table in FROM clause ? I'm confused!!!
Can someone point me to a good link where I can find answers to questions related to optimizing sql statements, and which conditions use indexes and which don't (using wildcards with LIKE clause disables indexes ???) and related doubts.
Thanks a lot. I appreciate all the responses.
 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The driving table is the "point" table for your database request. If you have a query for an employee record, it would be the employee table, and the address table is driven off of the employee table. So it is the pivotal table in the request. An picking the right one does effect performance.
There are so many things to look at for tuning performance that the write entire books on the subject. And it also depends on the database you have because they each optimize differently. Yes, if you use like '%abc% an entire table scan will be done. If you use functions like substr on a column before comparing it, the indexes can't be used. But you really need to get some books on the subject for the database being used.
Dan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic