473,587 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unnacceptable waitingtime for a left join query. What's wrong?

Hi!

Please have a look at the following query:

SELECT BOOKS.ISBN, BOOKS.TITLE, IMAGES.WEIGHT, IMAGES.WIDTH
FROM BOOKS
LEFT JOIN IMAGES ON BOOKS.ISBN = IMAGES.ID
WHERE MATCH(BOOKS.TIT LE) AGAINST ('mysql database')

BOOKS.ISBN is primary key and IMAGES.ID is primary key

This query USUALLY takes less than 1 sec, but SOMETIMES it can take
about 15 - 25 seconds to complete.

When I remove the LEFT JOIN part the query ALWAYS is very fast.

My MySql version is 3.23.53

When I run EXPLAIN I get the following info:

+--------+----------+---------------+---------+---------+-----------+------+------------+
| table | type | possible_keys | key | key_len | ref |
rows | Extra |
+--------+----------+---------------+---------+---------+-----------+------+------------+
| BOOKS | fulltext | NAME | NAME | 0 | |
1 | where used |
| IMAGES | eq_ref | PRIMARY | PRIMARY | 10 | BOOKS.ISBN|
1 | |
+--------+----------+---------------+---------+---------+-----------+------+------------+

I've tried to optimize both tables, that didn't help.

Any ideas of why the query sometimes takes very long time to finish?

Leif
Jul 19 '05 #1
0 809

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2438
by: Marek Lewczuk | last post by:
Hello, I have a strange problem, maybe some of you will be able to explain me something. I use LEFT JOIN as a substitute for subselects. It's true that many subselects can be rewriten using LEFT JOIN. I have made a query which use LEFT JOIN statement and... when there are many LEFT JOIN's (over 3) on the same table MySQL execute this query...
0
13000
by: Petre Agenbag | last post by:
Hi List Me again. I'm trying to return from multiple tables, the records that have field "information_sent" between two dates. The tables are all related by means of the id of the entry in the main table, ie.. main id entity_name ...
0
1169
by: Leif Wessman | last post by:
Hi! Please have a look at the following query: SELECT BOOKS.ISBN, BOOKS.TITLE, IMAGES.WEIGHT, IMAGES.WIDTH FROM BOOKS LEFT JOIN IMAGES ON BOOKS.ISBN = IMAGES.ID WHERE MATCH(BOOKS.TITLE) AGAINST ('mysql database') BOOKS.ISBN is primary key and IMAGES.ID is primary key
1
4616
by: Quarco | last post by:
Hi, Suppose I have a query like: SELECT products.name AS product, SUM(IF(stock.invoice=0,1,0)) AS in_stock, SUM(IF(shopcart.status=1,1,0)) AS reserved FROM products LEFT JOIN stock ON products.id=stock.product_id
4
4098
by: jbm05 | last post by:
Hi, I'm curious about the computational complexity of a query I have. The query contains multiple nested self left joins, starting with a simple select, then doing a self left join with the results, then doing a self left join with those results, etc. What puzzles me is that the time required for the query seems to grow exponentially as I...
2
6385
by: Ryan | last post by:
I'm going daft. I have what should be a simple query and it seems that the left side of the join is being ignored. The query and DDL are below. Basically, my RDOData_Extract_Lines table (where LineNum NOT LIKE 'LAN%') on it's own gives me 959 records. If I look at the RDOData_Extract table (with the dealer code = 8494) it shows 521 records....
7
31546
by: Steve | last post by:
I have a SQL query I'm invoking via VB6 & ADO 2.8, that requires three "Left Outer Joins" in order to return every transaction for a specific set of criteria. Using three "Left Outer Joins" slows the system down considerably. I've tried creating a temp db, but I can't figure out how to execute two select commands. (It throws the exception...
2
2656
by: terence.parker | last post by:
I am often faced with the dilemma of whether to use a JOIN query across three tables in order to grab a bunch of results - or whether to create another table to represent what I want. The latter is less normalised, but seems less computationally expensive to me(?). Basicially what I have is: Friend (uid1,uid2,fid) ->...
3
23082
by: Ian Boyd | last post by:
i know nothing about DB2, but i'm sure this must be possible. i'm trying to get a client to create a view (which it turns out is called a "Logical" in DB2). The query needs a LEFT OUTER JOIN, but he doesn't know how to do that, or even if he can, and i don't have to time to learn DB2 from scratch right now. The following SQL Query is a...
3
1412
by: zykes | last post by:
I have this query that produces Syntax Error(missing operator) in query operation ForumTopics.TopicID = ForumReply.TopicID LEFT OUTER JOIN Members ON ForumTopics.WrittenBy = Members.Member_ID this is the query: SELECT ForumTopics.TopicID, ForumTopics.TopicName, Members.FName, COUNT(ForumReply.ReplyID) AS Reply, ...
0
7923
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.