Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

MySQL Query Takes Too Long.

Posted on 2012-08-15
2
Medium Priority
?
753 Views
Last Modified: 2012-08-15
This query runs quickly in MSSQL, however extremely slow in MySQL. Help!

INSERT INTO Archives (DateIn, `Priority`
(SELECT DateIn, `Priority`
 FROM Logs s
 JOIN Ports p on p.Port = s.Port And p.Secured = '1'
 Where Not Exists (Select DateIn From Users Where DateIn = s.DateIn))

 -- or --

Where DateIn Not In (Select DateIn From Users))
0
Comment
Question by:pointeman
2 Comments
 
LVL 8

Accepted Solution

by:
mrh14852 earned 2000 total points
ID: 38298494
What fields do you have your indexes built on.  At the least you need indexes on the fields you join and in your where clauses.
0
 

Author Closing Comment

by:pointeman
ID: 38298848
Created index on both tables for Join purposes, thx
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how the fundamental information of how to create a table.

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question