Solved

MySQL speed up query with index?

Posted on 2011-09-30
4
427 Views
Last Modified: 2012-05-12
I am comparing 2 tables each with common field called mniNum and removing duplicate records from the one table by comparing records in each table.   If I create an index in each table using the common field will that help speed up the process?

What else can I do to speed up a query that must compare each record between two tables?
0
Comment
Question by:pda4me
  • 2
4 Comments
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 36891355
surely it will. use Explain <QUERY> to find out index hints.
If you can post your queries and table definition it'd be clear picture.
0
 
LVL 8

Accepted Solution

by:
Leo Torres earned 500 total points
ID: 36892063

Well sounds like you have answered you own question if this column your comparing is not a primary key then write an index for that column..

FYI.. Primary Keys automaically get an index Clustered Indexs

You you have to create an index on a column that is a non-clustered Index

These indexs will imporve look times on tables

By imporoving Lookup when you add Indexs on a table you will increase insert times so I hope you dont have a lot of inserts to this table or large inserts for that fact ..

You have a trade of there you going to have to deal with and decide which is more important..

good luck!!
0
 

Author Comment

by:pda4me
ID: 36892089
Ltorres,  will delete also be increased in addition to insert times when there is an index?  I am actually comparing the tables and removing records.
0
 
LVL 8

Expert Comment

by:Leo Torres
ID: 36892364
Yes corect deletes as well

Here is a good resource
http://download.oracle.com/docs/cd/B10501_01/server.920/a96533/data_acc.htm

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Character matching different date formats for dates between 6 59
Procedure syntax 5 38
Inserting data into database 10 34
Help with Oracle IF statment 5 23
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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