performance - Improve speed of a JOIN in MySQL -


I know a similar thread around there, but this is actually the first time I think that query speed affects me So it is not easy for me to actually transfer from other people's problems.

Being said I'm successfully using the following queries with small data, but if I use it on what are the lighter tables (records about 120,000). I am waiting for hours

  select anothertable (id, someint1, someint1, somevarchar1, somevarchar1), DISTINCT md.id, md.someint1, md.someint1, md.somevarchar1, table1 From joining MD to pd.somevarchar1 join PD as the table 2 (md.id = pd.id);  

There are approximately 120,000 records in Tables 1 and 2. The question is currently running for about 2 hours. Is this normal? Do I just have to wait, I do not really know, but I am sure that since one is better than this it could be my first attempt.

I have read about indexing, but so far do not know the index in my case?

Thanks for any suggestions - I do not hesitate to direct beginners guides!

p> assuming id is an automatic incremental P, DISTINCT

And as mentioned earlier, make sure that the id field is an index on both tables (which does this if it is PK).


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -