1

I'm pretty new to Xamarin.Forms as well as LiteDB

I'm trying to query a table that I know has one very heavy column, but I do not need this column in this query

At the moment the query is very slow. In my SQL Server background, I would write a SELECT to include only necessary columns. In LiteDB it does not seem to make a difference.

Please advise (Maybe I'm just too SQL oriented :-) )

Here's my code, including some commented tests, to no avail.

var reps = DataConnection.GetList("Report");//.FindAll();
//reps = reps.Where(x => x["ParentRecordType"].RawValue == null);
            var reps2 = reps.Find(Query.Where("ParentRecordType", x => x.AsString is null));
            var reps3 = reps2.Select(x => new {ID= x.ID(), Name = x["Name"].AsString });
            var reps4 = reps3.ToList();
            //var reps2 = reps.Select(x => new { ID = x["ID"],Title= x["Name"].AsString }).ToList();
            //var repl = reps2.Select(x => new EntityType { Name = x.ID().ToString(), Title = x["Name"].AsString, Popularity = 0 });

TIA!

Yisroel M. Olewski
  • 1,560
  • 3
  • 25
  • 41
  • 1
    I don't believe that LiteDB has the concept of columns like an SQL DB does, so I'm not sure that your question even makes sense. You'd be better off looking at it is "how do I optimize a slow LiteDB query?" instead. – Jason May 19 '19 at 12:55
  • thanks @Jason, I now found this https://github.com/mbdavid/LiteDB/issues/931, seems that `LiteDB` does not the support partial decoding. Seems best thing is to split the collection in 2. – Yisroel M. Olewski May 21 '19 at 08:36

0 Answers0