Hi. Currently when returning a subset of data from a table, I am using the following code:
var response = db.LoadSelect<SomeEntity>()
.Where(x => x.SomeID == request.SomeID)
.OrderByDescending(x => x.DateCreated).Take(50);
and the performance of the query method has blown out to ~6s while a direct query on the db using:
SELECT * FROM `xyz`.SomeEntity
where SomeID = '000000000...'
returns in ~0ms
My question is, is this the wrong way to construct the query using ormlite, should I be using .Limit(50) instead of .Take ?
The table does need some indexing added, but there still appears to be a performance problem here in my code.
Update on this, this appears to work correctly (DB Server side)
var response = db.LoadSelect(db.From()
.Where(x => x.SomeEntityID== request.SomeEntityID)
.OrderByDescending(x => x.DateCreated)