Hi Gunnar,

I agree, this should be optimized.

It says in the Internals manual, I believe, that the code already exists
(in what version(s) I don't know) to optimize such searches on multiple
indexes but it just isn't implemented yet. Hopefully it will be soon...


Matt


----- Original Message -----
From: "Boehn, Gunnar von"
Sent: Tuesday, November 18, 2003 4:23 AM
Subject: Feature wish


> Hi,
>
> I wonder if a small enhancement to the
> mysql planner/optimizer could be made.
>
>
> The current (mysql4.0) optimizer only uses one index per SELECT.
> Because of this some queries result in a slow fulltable scan
> even if all used columns are indexed.
>
> Example:
> SELECT * FROM table1 WHERE columnA='x' OR columnB='x'
> (Slow table scan even if columnA and columnB are indexd!
>  Other Databases like PostgreSQL don't have this problem.)
>
>
> Since Mysql 4.0 a UNION can be used to speed this up.
>
> Example:
> SELECT * FROM table1 WHERE columnA='x'
> UNION SELECT * FROM table1 WHERE columnB='x'
> (Now we have two SELECT with one index each.)
>
>
> Couldn't the planner/optimizer be easely changed to do this UNION
> automaticly ?
>
>
> I think this would be a big improvement to mysql.
>
> If I port applications from other databases to mysql
> there are often queries like this. Either those queries
> run terrible slow an mysql or I have to manually convert them into
UNIONs.
>
>
> Thanks in advance
> Gunnar


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

Reply via email to