Martin,
1) I would insure there is an index on both TABLEY2.y_id and Y_TABLE.y_id
2) I would change the subselect in your insert statement to be a LEFT
JOIN... WHERE xxx IS NULL.
INSERT INTO X(column1)
SELECT Y.y_id
FROM Y_TABLE Y
LEFT JOIN TABLEY2 t2
ON t2.y_id = Y.y_id
WHERE t2.y_id IS
Hi Martin,
Speaking more from a general standpoint (I mostly work with MS SQL, but my
home projects are MySQL - these days there is precious little time for
those, though)..
Assuming you have appropriate indexes on tables y and y2:
1. Truncate WILL be faster than delete, as it is a non-logged
Thanks Shawn!
Marty Gainty
(cell) 617-852-7822
From: [EMAIL PROTECTED]
To: Martin Gainty [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: Optimising SQL Statements
Date: Fri, 25 Jun 2004 12:59:28 -0400
MIME-Version: 1.0
Received: from lists.mysql.com ([213.136.52.31]) by mc3-f2.hotmail.com