On 02/27/2013 10:29 PM, Greg Sabino Mullane wrote:
Not sure what you mean - index hints? Yeah, that could
be a little tricky,
but luckily the Postgres part, at any rate, doesn't have to worry about
those (as our planner is smart enough to pick the best index itself ;).
I can't think of a clean way to abstract that anyway, as just needing
an index hint for MySQL does mean the same is needed on Oracle, and
vice-versa. So you'd already have a very database specific argument
for each query anyway, such that you would never have to worry if other
dbs had the same index.
No, I was just talking about defining the indices (obviously, the query
planner is out of luck if you don't define them properly). E.g. in the
PostgeSQL tables.sql file:
CREATE INDEX archive_name_title_timestamp ON archive
(ar_namespace,ar_title,ar_timestamp);
Even though often this syntax is the same cross-db, since the whole file
is db-specific (except MySQL and SQLite share), people have the option
of db-specific index variants.
You're right index hints at query time could conceivably help, but it
doesn't seem like a priority.
Matt Flaschen