Home » Performance » MySQL » Select slow
Select slow [message #1373] Thu, 07 June 2007 11:21 Go to next message
shalmoli  is currently offline shalmoli
Messages: 1
Registered: June 2007
Junior Member
I have two tables - one with around 80,000 rows(27 fields) and the other with 65,000 rows(2 fields).
When I do a simple select which involves a join, the database hangs. Show processlist displays the status as 'sending data' - this stage exists for indefinite time.

Select count(tbl1.tbl1_id) from tbl1,tbl2 where tbl1.tbl1_id = tbl2.foreign_key

Each of the tables have a primary key and no other index.

What may I do to make the joins faster.
Re: Select slow [message #1431 is a reply to message #1373 ] Sat, 16 June 2007 12:23 Go to previous message
VictorZ  is currently offline VictorZ
Messages: 9
Registered: June 2007
Junior Member
Have you tried defining an index on "tbl2.foreign_key"
Previous Topic:lost connection to mysql server during query
Next Topic:error #1117 "too many columns"
Goto Forum:
  


Current Time: Thu Jul 9 20:58:52 EDT 2009

Total time taken to generate the page: 0.02203 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.