Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Solving the problem of slow query in my efcore.

$
0
0

So I built an inventory application. I occasionally experience slow queries when retrieving data. This got me worried cos the client is complaining.

So I would paste one of the major query returning slow data.

 public async Task<IEnumerable<Customer>> Getcustomers()
        {
            var customers = await this.context.Customers.Include(item => item.Customercategory).Include(item=>item.Customercontact).Include(item=>item.Sex).ToListAsync<Customer>();

            return customers;
        }

It takes close to 10 seconds to return data.

Please how do I speeding up my queries when displaying or pulling data from the database. I experience this on just a 100 records.

Thanks alot.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>