ratty
ratty

Reputation: 13444

How to speed up data retrieval from Mysql database

I am working with c# windows form application and using mysql as back end. I have a table employee. In that I have more 2000 rows its just a example likely more record. When I'm retrieving and filtering the data from database my application is getting slow. Is there another way to retrieve database in good speed? Shall I achieve the speed by using Linq?

Upvotes: 3

Views: 2051

Answers (5)

rahim asgari
rahim asgari

Reputation: 12437

add index to your fields participating in JOINS and WHERE clauses.

Upvotes: 0

Jeff Norman
Jeff Norman

Reputation: 1044

You can get a speed up by using lazy loading (there are several tutorials over the internet) or just select those ones that interest you.

Upvotes: 0

Jagmag
Jagmag

Reputation: 10366

2000 records is a relatively small table. What is the size of each row?

Retrieving / Filtering from such a small table should be very fast atleast at a DB level.

  • View the Query Plan of your query and Optimize your query based on it.

  • Especially check your indexes and see how they are being used in your query and if you need to add / change any for them to be optimally used.

If you post your query and its execution plan, people might be able to point out some specifics as to how you may be able to improve on it!

Upvotes: 0

Arsen Mkrtchyan
Arsen Mkrtchyan

Reputation: 50752

How do you retrieve data now? are you using ado.net? but Stored procedures with ado.net is the fastest way I guess, are you sure that data retrieve is the slowest,2000 records is not so big table, so I guess your UI components are working slower?

Upvotes: 0

Andreas Paulsson
Andreas Paulsson

Reputation: 7813

Just make sure that you perform filtering in the database using WHERE (if you are using SQL for data access).

If you are using linq or not does not matter much as long as the SQL that is executed in the database is good (proper filtering using WHERE and indexes).

Upvotes: 1

Related Questions