November Happy Hour will be moved to Thursday December 5th.

smithsson68@gmail.com
Jan 31, 2011
  5739
(2 votes)

Dynamic Data Store Tips: Don’t use Find when you know an object’s “Id”

I have seen a few examples of code where an object is to be read from the Dynamic Data Store. The calling code has the objects “Id” value but use the Find method of DynamicDataStore to load the object.

Find works by generating a simple where clause against the store’s database view. The problem here is that the “Id” column in a store’s view is a non indexed manufactured string value based on the underlying StoreId (int) and ExternalId (Guid). Searching against this will be slow when dealing with a large number of rows.

If you know the “Id” of an item you should ALWAYS use the Load method of the DynamicDataStore. Load searches directly against either the StoreId or ExternalId columns, both of which are indexed.

See my previous blog entry Best (and fastest) ways to load items from the Dynamic Data Store for more details of loading.

Happy loading!

Jan 31, 2011

Comments

smithsson68@gmail.com
smithsson68@gmail.com Jan 31, 2011 10:10 AM

Side note: Passing "Id" to Find will throw an exception from EPiServer vNext (CMS 7 probably)

Anders Hattestad
Anders Hattestad Jan 31, 2011 10:55 AM

But if I want to query on the int or guid part of the ID, is that ok?
or will you throw an exteption on that also

as in this post
http://world.episerver.com/Blogs/Anders-Hattestad/Dates/2011/1/PageProviders-and-DDS-a-match-from-heaven/

Jan 31, 2011 11:26 AM

Yes, it will still be possible to query with LINQ against ID

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog

I'm running Optimizely CMS on .NET 9!

It works 🎉

Tomas Hensrud Gulla | Nov 12, 2024 | Syndicated blog

Recraft's image generation with AI-Assistant for Optimizely

Recraft V3 model is outperforming all other models in the image generation space and we are happy to share: Recraft's new model is now available fo...

Luc Gosso (MVP) | Nov 8, 2024 | Syndicated blog