Solved

MySQL speed up query with index?

Posted on 2011-09-30
4
426 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

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 …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

816 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now