I have a question with regards to querying performance in Umbraco.
Let's imagine you have a Document Type Property which has got fields such as
Price - int
Reference Code - string
Property Type - nuPicker Lucene Typeahead List which stores the relation of the Property with the Property Type (e.g. villa, bungalow etc.) in JSON format
In order to query the above, let's say you want to load the properties who have a price less than 100,000 and which are of type "Villa" which has a PropertyType ID of 192.
Let's say all the properties are children of a parent node 'Properties', with ID 1023.
If we do something like the following:
var propertiesNodeId = 1023;
var searchPropertyTypeId = 192;
var filteredProperties = Umbraco.TypedContent(propertiesNodeId).Children.Where(x =>
(x.GetPropertyValue<int>("price") < 100000) &&
(x.GetPropertyValue<nuPickers.Picker>("propertyType").PickedKeys.Contains(searchPropertyTypeId.ToString())));
Would this mean that it would be loading all the properties in memory and then filtering them using those criteria? Is this approach recommended?
Also, for pagination, when you use Skip() and Take() would it also be initially loading them all in memory and then just skipping / taking the required?
In terms of querying performance, what would be the best option to do such a search / filtering?
Use an examine search will be super fast. You may need to use Gatheringnode data event to get the nupicker field which I am assuming is stored as csv set up to be injected into the index as space separated list.
Thanks a lot for your reply. I am sure that Examine will provide a super fast search.
Still, in reply to my question above, would the above code end up loading all the data from the DB in memory and then filtering them out through the Where, Skip and Take methods?
Umbraco Querying Performance
I have a question with regards to querying performance in Umbraco.
Let's imagine you have a Document Type
Property
which has got fields such asPrice
- intReference Code
- stringProperty Type
- nuPicker Lucene Typeahead List which stores the relation of the Property with the Property Type (e.g. villa, bungalow etc.) in JSON formatIn order to query the above, let's say you want to load the properties who have a price less than 100,000 and which are of type "Villa" which has a PropertyType ID of 192.
Let's say all the properties are children of a parent node 'Properties', with ID 1023.
If we do something like the following:
Would this mean that it would be loading all the properties in memory and then filtering them using those criteria? Is this approach recommended?
Also, for pagination, when you use
Skip()
andTake()
would it also be initially loading them all in memory and then just skipping / taking the required?In terms of querying performance, what would be the best option to do such a search / filtering?
Thanks in advance for your help!
Mark,
Use an examine search will be super fast. You may need to use Gatheringnode data event to get the nupicker field which I am assuming is stored as csv set up to be injected into the index as space separated list.
Regards
Ismail
Thanks a lot for your reply. I am sure that Examine will provide a super fast search.
Still, in reply to my question above, would the above code end up loading all the data from the DB in memory and then filtering them out through the
Where
,Skip
andTake
methods?is working on a reply...