My application is in C# [.NET 3.5] and MySQL 5.1 back-end.
I have a Windows Form with a TextBox and a DataGridView. When the user types in few characters in the TextBox, an SQL Query with a Like clause is run to filter the records shown in the DataGridView below.
The items list has grown considerably and also I don’t find running an SQL query on each character input appropriate. An alternative way I think is to create a DataSet when the application loads and fill it with the recent stock position upfront. Than use LINQ or something like that to filter the in-memory record-set. But this method is also not optimized because whenever a new bill is created, items from the stock are reduced and each time I will need to update the in-memory record-set.
Is there any other optimized and faster way?
There are a few optimizations that can be done
Database layer
Great post on how to optimize everything on db side
You can also try sharding and horizontal scaling
Application side
Do not use dataset, as they are heavy, bulky, slow and make it hard to maintain the same copy of data as on the db. Think over a few tricks:
Infrastructure