Reduce db roundtrips
See original GitHub issueHi,
Is it possible to reduce db roundtrips by sending requests by batch ( Like NHibernate Future<T>() ) ?
For the paging example, it’s ok to have two requests, but could we send them togheter in one batch and parse the results one time ? :
public static List<Product> Search(string searchFor, int currentPage, int pageSize, out int totalRecords)
{
using (var db = new DbNorthwind())
{
var products = from p in db.Product
select p;
if (searchFor != null)
{
products = from p in products
where p.Name.Contains(searchFor)
select p;
}
totalRecords = products.Count();
return products.Skip((currentPage - 1) * pageSize).Take(pageSize).ToList();
}
}
Thank you,
Yassine
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Reducing Round Trips
One of the best ways to reduce the load on your server and increase application responsiveness is to reduce the number of "round...
Read more >c# - Reducing roundtrips to the server/database
Round trips are more relevant to latency than the total quantity of data being moved, so it really does make sense to optimize...
Read more >Tip: Reduce round trips to the database server
Round trips to the server are more important than the amount of data being passed to the server. In many cases, the number...
Read more >Reducing Database Round-Trips with Boring Queries
If your application relies on a substantial amount of database requests, strategies like reusing what's already available in the application ...
Read more >High Performance Web - Reducing Database Round Trips
In an optimal situation the things we'll talk about will help to reduce the amount of time required to serve a result that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, @loudadyassine, not yet. But we had thoughts about that. Not as it is done in NHibernate but in our way.
But, I’ve spent 20 minutes for writing for you simple class which should help in your situation if database supports Window functions.
And usage:
This is awesome, thank you 👍