Scott Gifford <[EMAIL PROTECTED]> writes:

[...]

> I think I'm going to take a look at the MySQL source and see if
> there's anything I can tweak to get the effect I want.  I'll report
> back my results.

The MySQL source looked a bit too complex for casual hacking, but
here's what I ended up doing.  When I'm JOINing a table to the primary
table, if there are no columns in the table which are used in the
WHERE or ORDER BY clause, then I do a LEFT JOIN instead of a regular
JOIN.  That seems to stop MySQL from choosing bad plans in the cases
that are common for my application, since in most cases WHERE and
ORDER BY use only columns from the primary table, so the table with
the ORDER BY will end up first, so the index can be used.

---ScottG.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to