Really slow queries when joining

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

Really slow queries when joining

Post by GeXus »

I've been having really slow queries when doing joins.. specifically I'm joining to a highly transactional table - is it common to have slow queries in cases like that? All my indexes are setup properly as well.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

What does an EXPLAIN tell you?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

What type of table is it? You may be having issues with it being locked as well.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Also are you returning just the information you want ? Using "SELECT *" often slows queries down considerably if there are a lot of columns involved.

Generally when asking questions like this it helps us to have more details such as an example to comment on.
chakhar86
Forum Commoner
Posts: 45
Joined: Mon Jun 05, 2006 1:36 am
Contact:

Post by chakhar86 »

Maybe you use non-integer primary/foreign key (or index) its dragging down performance of database.

Make sure you only use integer type for key field
Post Reply