SQL Tip 1:Use JOIN instead of subqueries. As a programmer, subqueries are something that we can be tempted to use and abuse.
Subqueries, as show below, can be very useful: SELECT a.id,
(SELECT MAX(created)
FROM posts
WHERE author_id = a.id)
AS latest_post FROM authors a
SQL Tip 2:Prune SELECT lists. Every column that is SELECTed consumes resources for processing. There are several areas that can be examined to determine if column selection is really necessary.
Example:WHERE (COL8 = ‘X’)