Hello,

i've the db of CD Titles which among others contains tables:

Titles
Songs
SongAuthors
SongIntereprets
Persons

I need to perform queries which outputs a set of Titles matching the criteria which 
restrict either or all of the tables. If I make a join of the tables with restrictions 
on each table, the query is quite fast unless I use DISTINCT to exclude duplicite 
titles. When I use distinct, it creates disk-temp tables and the query is 12sec.

Is there any solution without distinct?

I thought of:
using temporary HEAP table for collecting title IDs and somehow forsing MySQL to 
insert only UNIQUE IDs from the JOIN and than joining this with titles. But how to 
forse MySQL to do this?

or

Creating a procedure which would cycle through Joined set of Songs, Authors, 
Interprets, Persons and put in the temp HEAP only the one record which does not the 
same ID as the previous one. But I'm neither sure if this is possible in mySQL nor if 
this is faster then the DISTINCT.

Thanx for any help.


Miroslav Renda
http://www.m7m.cz 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to