Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mysql Inner Join Query Mysql vs Access

Status
Not open for further replies.

Herby1976

Programmer
May 7, 2009
11
BE
I run a Mysql server 5.1 as test on a little server. I compare the same SQL statement whit Mysql and access. Whene i use de sql statement "select dconlinelog.logtabel.* , klanten.klanten.* from(dconlinelog.logtabel)inner join klanten.klanten ON dconlinelog.logtabel.Log_KLNR = klanten.klanten.Klantnummer"

I run it on acces with oledb connection and Mysql with the connector from Mysql. Access do this sql at 10 sec and mysql need 55 sec to do the same. I found out that the cpu is the bottleneck for the query. The application runs on the server so the same cpu i use for access. From where the big difference?? (With simpel sql statement is mysql 10 times faster then access)
 
klanten.klanten.Klantnummer is the primairy key for that table so also automatic a index for that table.
 
So what you basically want is an index on logtabel.Log_KLNR as well. If they have the same data type, you can even define a foreign key relation (like in access).

If you want to see how the query is optimized, put an EXPLAIN command in front of it (only works with select as far as I know):

Code:
EXPLAIN select dconlinelog.logtabel.* , klanten.klanten.* from(dconlinelog.logtabel)inner join klanten.klanten ON dconlinelog.logtabel.Log_KLNR = klanten.klanten.Klantnummer
The result will tell you which indexes are used, if any.


+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)
 
Something else: you did make it a pass-through query, don't you? Otherwise, MS-Access parses the query itself (using its own SQL dialect and you can use MS-Access functions) and has to "download" the entire tables to be able to. Even if you request just one record.

+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)
 
Ok gone try to define a foreign key relation. First try give some errors but gone try it again later again.
 
The relations solve the problem. Do it now in less then 0.5 seconds. Thnaks for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top