MySQl vol.2
Here’s some more mysql odds and ends I’ve been picking up:
- MySIAM and no deletes: If you never delete rows from a mysiam table, mysql won’t lock the whole table when you do inserts. In other words, people can run selects on the table while an insert is happening. I’m build this application right now with a column name is_deleted that I set to “1″ where I would have deleted the row. Then all my SELECTS have to have a “is_deleted=’0′” in the WHERE. I wonder if complicating my WHERE actually adds more time than not deleting saves…
- Joins: According to the High Performance MySQL book I’m reading, choosing the order to join table is “one of MySQL’s weakest skills.” Figuring out best to do the join can take longer than running the SELECT. Thus, I’m taking from this: keep JOINs to a minimum.
- SQL_CALC_FOUND_ROWS: Apparently using FOUND_ROWS() can be slower than running a second, non LIMIT-ed SELECT when you are trying to find how many total rows match your query.

