Solved

MySQL speed up query with index?

Posted on 2011-09-30
4
433 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Creating and Managing Databases with phpMyAdmin in cPanel.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

729 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