List:General Discussion« Previous MessageNext Message »
From:Gleb Paharenko Date:July 18 2005 10:42pm
Subject:Re: Multitable selection
View as plain text  
Privet!

> What is faster: UNION or temporary table or something else ?

Sometimes MERGE tables could be used, but  the speed difference  between
UNION solution and MERGE is rather low. The temporary table for sorting
(ORDER clause causes this) should be created in all cases. So, if you
have to reuse data returned from the query several times, create a 
temporary table from results. BTW - what query (queries) are you going
to use for sorting data from several tables?  I see simple subquery like:

	create temporary table t1
	select a
	from (
	 				select a 
					from d1 
					union 
					select a 
					from d2
				) as foo
	order by a;

If you have faster solution (in several times) please introduce it. I've
seen similar issues at archives at:
  http://lists.mysql.com/mysql

odnako, I haven't found an exact answer. :)



> Hello,
> 
> I have 10 tables:
> table0: id, description, date
> table2: id, description, date
> ...
> table9: id, description, date
> 
> Every table has 1 000 000 rows.
> 
> How can I select all rows from this 10 tables ordered by date?
> What is faster: UNION or temporary table or something else ?
> 
> mysql 4.1
> 
> Sincerely,
> Michael,
> http://xoib.com/ http://3d2f.com/
> http://qaix.com/ http://ryxi.com/
> http://gyxe.com/ http://gyxu.com/
> http://xywe.com/ http://xyqe.com/
> 
> 


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   Gleb.Paharenko@stripped
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com



Thread
Multitable selectionМихаил Монашёв17 Jul
  • Re: Multitable selectionGleb Paharenko19 Jul
    • Re: Multitable selectionMichael Monashev19 Jul
RE: Multitable selectionMikhail Berman18 Jul
  • log fileprathima rao18 Jul
    • Re: log fileBruce Ferrell18 Jul
  • Re: Multitable selectionMichael Monashev19 Jul
Re: Multitable selectionPeter J Milanese19 Jul
  • Re: Multitable selectionMichael Monashev19 Jul
RE: Multitable selectionPMilanese19 Jul