Slow Union Statement

Slow Union Statement

am 05.04.2010 20:06:46 von chen jia

Hi there,

I run simple statement like this:

create table c
select * from a
union
select * from b;

where table a has 90,402,534 rows, and table b has 33,358,725 rows.
Both tables have the same three variables.

It's taken a long time, more than half an hour now. How do I make it faster?

Best,
Jia

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Slow Union Statement

am 05.04.2010 20:10:15 von Rudy Lippan

On 04/05/2010 02:06 PM, chen jia wrote:
> Hi there,
>
> I run simple statement like this:
>
> create table c
> select * from a
> union
> select * from b;
>
> where table a has 90,402,534 rows, and table b has 33,358,725 rows.
> Both tables have the same three variables.
>
> It's taken a long time, more than half an hour now. How do I make it faster?


UNION ALL, perhaps?

-r

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

RE: Slow Union Statement

am 05.04.2010 20:13:38 von Gavin Towey

Union does a distinct on all results. UNION ALL will avoid that.

Regards,
Gavin Towey

-----Original Message-----
From: chen.1002@gmail.com [mailto:chen.1002@gmail.com] On Behalf Of chen ji=
a
Sent: Monday, April 05, 2010 11:07 AM
To: mysql@lists.mysql.com
Subject: Slow Union Statement

Hi there,

I run simple statement like this:

create table c
select * from a
union
select * from b;

where table a has 90,402,534 rows, and table b has 33,358,725 rows.
Both tables have the same three variables.

It's taken a long time, more than half an hour now. How do I make it faster=
?

Best,
Jia

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgtowey@ffn.com


This message contains confidential information and is intended only for the=
individual named. If you are not the named addressee, you are notified th=
at reviewing, disseminating, disclosing, copying or distributing this e-mai=
l is strictly prohibited. Please notify the sender immediately by e-mail i=
f you have received this e-mail by mistake and delete this e-mail from your=
system. E-mail transmission cannot be guaranteed to be secure or error-fre=
e as information could be intercepted, corrupted, lost, destroyed, arrive l=
ate or incomplete, or contain viruses. The sender therefore does not accept=
liability for any loss or damage caused by viruses or errors or omissions =
in the contents of this message, which arise as a result of e-mail transmis=
sion. [FriendFinder Networks, Inc., 220 Humbolt court, Sunnyvale, CA 94089,=
USA, FriendFinder.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: Slow Union Statement

am 05.04.2010 20:18:08 von chen jia

Yes, that's the trick. Thank Rudy and Gavin.

Best,
Jia

On Mon, Apr 5, 2010 at 2:13 PM, Gavin Towey wrote:
> Union does a distinct on all results. =A0UNION ALL will avoid that.
>
> Regards,
> Gavin Towey
>
> -----Original Message-----
> From: chen.1002@gmail.com [mailto:chen.1002@gmail.com] On Behalf Of chen =
jia
> Sent: Monday, April 05, 2010 11:07 AM
> To: mysql@lists.mysql.com
> Subject: Slow Union Statement
>
> Hi there,
>
> I run simple statement like this:
>
> create table c
> select * from a
> union
> select * from b;
>
> where table a has 90,402,534 rows, and table b has 33,358,725 rows.
> Both tables have the same three variables.
>
> It's taken a long time, more than half an hour now. How do I make it fast=
er?
>
> Best,
> Jia
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: =A0 =A0http://lists.mysql.com/mysql?unsub=3Dgtowey@ffn.co=
m
>
>
> This message contains confidential information and is intended only for t=
he individual named. =A0If you are not the named addressee, you are notifie=
d that reviewing, disseminating, disclosing, copying or distributing this e=
-mail is strictly prohibited. =A0Please notify the sender immediately by e-=
mail if you have received this e-mail by mistake and delete this e-mail fro=
m your system. E-mail transmission cannot be guaranteed to be secure or err=
or-free as information could be intercepted, corrupted, lost, destroyed, ar=
rive late or incomplete, or contain viruses. The sender therefore does not =
accept liability for any loss or damage caused by viruses or errors or omis=
sions in the contents of this message, which arise as a result of e-mail tr=
ansmission. [FriendFinder Networks, Inc., 220 Humbolt court, Sunnyvale, CA =
94089, USA, FriendFinder.com
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg