OurSQL Episode 22: Things To Avoid With MySQL Queries

Feature:

Things to Avoid in Queries
Subqueries and Correlated subqueries
http://dev.mysql.com/doc/refman/4.1/en/correlated-subqueries.html

Jan Kneschke's post on Groupwise Maximum:
http://jan.kneschke.de/projects/mysql/groupwise-max

Calculated comparisons do not use indexes

INSERT IGNORE
REPLACE
INSERT...ON DUPLICATE KEY

Feedback:

Email podcast@technocation.org

call the comment line at +1 617-674-2369

use Odeo to leave a voice mail through your computer:
http://odeo.com/sendmeamessage/Sheeri

or use the Technocation forums:
http://technocation.org/forum

Direct play this episode at:
http://technocation.org/content/oursql-episode-22%3A-things-avoid-mysql-queries

Arnold -- Don't worry about

Arnold -- Don't worry about it. That's why these are "show notes" -- just notes, so to get the whole context you have to listen to the podcast.

I probably should have said "Avoid an extra SELECT by using INSERT IGNORE, REPLACE or INSERT....ON DUPLICATE KEY".

Ah, this is a potcast and it

Ah, this is a potcast and it would be smart to listen to it first before making a comment. (do I feel stupid now :s )

The postcast explains about INSERT IGNORE, REPLACE and INSERT…ON DUPLICATE KEY. It is not about how to avoid it, like the title might let you think.

Calculated comparisons do

Calculated comparisons do not use indexes:
http://blog.adaniels.nl/?p=36

Can anyone tell me why to avoid INSERT IGNORE, REPLACE and INSERT…ON DUPLICATE KEY? I can't imagine that a SELECT, than splitting out rows which should be updated/skipped and then and INSERT and/or UPDATE would be quicker. Of course it isn't fair to compare it with a plain INSERT call, because it doesn't accomplish the same.