Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li>Rather than store <code>Event.id</code> as a property, use the id automatically embedded in each entity's <a href="http://code.google.com/appengine/docs/python/datastore/keyclass.html" rel="noreferrer">key</a>, or set unique <a href="http://code.google.com/appengine/docs/python/datastore/entities.html#Kinds_IDs_and_Names" rel="noreferrer">key names</a> on entities as you create them.</li> <li>You have lots of options for modeling the relationship between <code>Event</code> and <code>JournalEntry</code>: you could use a <code>ReferenceProperty</code>, you could parent <code>JournalEntries</code> to <code>Events</code> and retrieve them with ancestor queries, or you could store a list of <code>JournalEntry</code> key ids or names on <code>Event</code> and retrieve them in batch with a key query. Try some things out with realistically-distributed dummy data, and use <a href="http://code.google.com/appengine/docs/python/tools/appstats.html" rel="noreferrer">appstats</a> to see what works best.</li> <li><code>UserComment</code> references an <code>Event</code>, while <code>JournalEntry</code> references a list of <code>UserComments</code>, which is a little confusing. Is there a relationship between <code>UserComment</code> and <code>JournalEntry</code>? or just between <code>UserComment</code> and <code>Event</code>?</li> <li>Persisting so many counts is expensive. When I post a comment, you're going to write a new <code>UserComment</code> entity and also update my <code>User</code> entity and a <code>JournalEntry</code> entity and an <code>Event</code> entity. The number of <code>UserComments</code> you expect per <code>Event</code> makes it unwise to include everything in the same entity group, which means you can't do these writes transactionally, so you'll do them serially, and the entities might be stored across different network nodes, making the whole operation slow; and you'll also be open to consistency problems. Can you do without some of these counts and consider storing others in memcache?</li> <li>When you fetch an <code>Event</code> from the datastore, you don't actually care about its list of search index words, and retrieving and deserializing them from protocol buffers has a cost. You can get around this by splitting each <code>Event</code>'s search index words into a separate child <code>EventIndex</code> entity. Then you can query <code>EventIndex</code> on your search term, fetch just the <code>EventIndex</code> keys for <code>EventIndexes</code> that match your search, derive the corresponding <code>Events</code>' keys with <code>key.parent()</code>, and fetch the <code>Events</code> by key, never paying for the retrieval or deserialization of your search index word lists. Brett Slatkin explains this strategy <a href="http://www.youtube.com/watch?v=AgaL6NGpkB8" rel="noreferrer">here</a> at 14:35.</li> <li>Updating <code>Event.viewCount</code> will fail if you have a lot of views for any <code>Event</code> in rapid succession, so you should try out counter <a href="http://code.google.com/appengine/articles/sharding_counters.html" rel="noreferrer">sharding</a>.</li> </ul> <p>Good luck, and tell us what you learn by trying stuff out.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload