When it comes to SQL, indexes are your friend!!!
SQL can be very efficient as long as you access your data using indexes. The problem most developers run into with relational databases is that they don’t give proper consideration to how the indexes are structured when creating their SQLs. The database software is going to extract the information you requested even if it needs to read thru every record in the table. One thing I have found is that joining tables together using a single query can sometimes confuse the database optimizer logic (if the SQL is not built correctly) causing a full table read, sometimes a full sub-table read for every record selected from the primary table. I have been developing code using ORACLE & MySQL for 12 years and try to stay clear of joins whenever I can. If you must join tables together try creating a view.
|