473,511 Members | 15,581 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.TITLE) 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 803

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

Similar topics

0
2430
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...
0
12989
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...
0
1164
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)...
1
4610
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...
4
4090
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...
2
6378
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...
7
31537
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"...
2
2649
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...
3
23074
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...
3
1408
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 =...
0
7245
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,...
0
7144
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7356
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,...
1
7085
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...
0
7512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3227
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...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
449
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...

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.