Slow query opening

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jarot
Posts: 5
Joined: Wed 04 Jan 2006 04:07

Slow query opening

Post by jarot » Mon 03 Jul 2006 04:49

Running the application with the application's exe and MySQL server on the same computer is always fast.

But when we tried to run the application from another computer, sometimes its slow, sometimes its normal.

What could possibly be the problem. I'm sure there's nothing wrong with the network connection.

Thanks.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 03 Jul 2006 12:59

Try to determine what actions slow down your application: connecting to the server, fetching data, executing INSERT, UPDATE, DELETE queries or something else.

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Tue 04 Jul 2006 22:31

If it's connecting to the database, check this:

http://dev.mysql.com/doc/refman/5.1/en/dns.html

Add the skip-name-resolve to your my.ini/cnf

If it's when opening the query (you're already connected), then look at the amount of data fetched. If you select all fields and only need a few ones, then adjust your query to retrieve only data you need. Retrieving big blobs also takes its time, sometimes it's better to get blobs only when you need them.

Regards

jarot
Posts: 5
Joined: Wed 04 Jan 2006 04:07

Re:

Post by jarot » Wed 05 Jul 2006 04:27

Thanks for the quick reply. :)

Antaeus, it seemed to be OK when we tried to connect to the database.

The problem started whenever we tried to fetch a data via TMyQuery. Simple query from a small table like

'select UserName from UserLogin where UserID = 1'

which returns 1 record requires a considerable time to execute (about 1 minute).

To GEswin, we only select the required fields. We never use 'select *' nor we ever select BLOB fields for a query that returns more than 1 records (e.g. for listing purpose).

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 05 Jul 2006 11:10

Please try to execute the same query with any other tool. For example standard MySQL client.

Post Reply