Re: Join with OR-condition and Indexes

2010-01-06 Thread Joerg Bruehe
Tobias, all, Tobias Schultze wrote: > Thanks for your answers. > > I found out, that MySQL behaves very strange in this situation. > I think this is a bug or important missing feature. I disagree. > > I would like to see how other DBMS behave in this situation, which I would > think is a comm

Re: Join with OR-condition and Indexes

2010-01-06 Thread Tobias Schultze
ists.mysql.com Cc: Tobias Schultze Betreff: Re: Join with OR-condition and Indexes What it comes down to is that MySQL can only use 1 index per table per query. The moment your query includes OR examining different columns, a full table scan is the only option. One typical way to implement this is t

Re: Join with OR-condition and Indexes

2010-01-05 Thread Michael Dykman
What it comes down to is that MySQL can only use 1 index per table per query. The moment your query includes OR examining different columns, a full table scan is the only option. One typical way to implement this is to use UNIONS as Mr. Green suggested: SELECT aid, count(*) FROM ( SELECT a.id FRO

Re: Join with OR-condition and Indexes

2010-01-05 Thread Shawn Green
Tobias Schultze wrote: Hello, I'm working on an application for my bachelor thesis. I'm having a performance problem with a SQL-Query in MySQL5. I hoped someone can easily enlighten me in this issue. The schema: CREATE TABLE IF NOT EXISTS `athletes` ( `id` int(11) NOT NULL AUT