I'm wondering if there is a faster method than using something like:
while (Reader.Read())
to read the results of mysql select queries.
I'm randomly pulling 10,000 rows from a database and would like to read it as quickly as possible. Is there a way to serialize the results if we know what they are (such as using the metadata to setup a structure)?
The C API provides low-level access to the MySQL client/server protocol and enables C programs to access database contents. The C API code is distributed with MySQL and implemented in the libmysqlclient library.
MySQL full-text search (FTS) is far much faster than queries using wildcard characters.
Contrary to the answers - In my experience, for views with lots of joins, doing a direct query runs faster.
Before you start to connect your application to MySql, you need to add add the mysql Reference in your project. To do so, right click our project name, and choose Add Reference, then choose "MySql. Data" from the list. Next, you need to add MySql Library in your C# project.
Try MySQLDataAdapter.Fill
method to fill any DataTable
object - read speed is comparable to optimal usage of read data with Read
method (depends on your while block reading way) and main advantage is that you achieve prepared data collection which you can manage or just write to XML file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With