I am using LiteDB, and trying to improve performance. I currently have two queries on the same table, and was wondering if there is another way to combine these two queries as one to improve performance.
using (var db = new LiteDatabase(_databaseFileName))
{
// Get a collection (or create, if doesn't exist)
var collection = db.GetCollection<IdentityKeyPair>(_tableName);
collection.EnsureIndex(x => x.Value);
collection.EnsureIndex(x => x.RecordId);
var entityKeyRecordId = collection.Query().Where(p => p.Value == uniqueValue).Select(x => x.RecordId).FirstOrDefault();
if (entityKeyRecordId != Guid.Empty)
results = collection.Query().Where(p => p.RecordId == entityKeyRecordId).ToList();
}