Query speed and results

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
lguy
Posts: 2
Joined: Sat 28 May 2005 15:19
Location: USA

Query speed and results

Post by lguy » Sat 28 May 2005 15:51

This is the query SQL:

select distinct lastname from vdata order by lastname

vdata has about 5 million rows, and this query returns about 6,000 rows. 2 questions:

1. How can I improve its speed? I takes about 9 seconds to run as opposed to 2 seconds when run from the MySQL Console app.

2. How can I figure out the number of rows returned by the query? I do a FetchRows but that runs the number 25.

Thanks,

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Mon 30 May 2005 07:33

Quick question : have you set some indexes ?, if not, setting up will speed up your query result

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 30 May 2005 08:51

> 1. How can I improve its speed? I takes about 9 seconds to run as opposed
> to 2 seconds when run from the MySQL Console app.

Try to set FetchAll to False. Please read carefully MyDAC help about restrictions of this mode.

> 2. How can I figure out the number of rows returned by the query?
> I do a FetchRows but that runs the number 25.

Just set Options.QueryRecCount to True

Post Reply