5
votes

I am working on an app engine project with datastore(creating our database),

As per the information give in this link total number of read write operation is listed for different case(Insert ,update and delete),but i am confused how write operation is calculated for modifying index and composite index.

we have below Case scenario in which we have to calculate number of write operation

1 >> Datastore query requires filtering based on single property no complex query [no index defined in datastore-indexes.xml file]

as per example “SELECT * FROM MESSAGE AS MESSAGE ORDER BY timestamp desc"

2>> Datastore query requires filtering based on single property no complex query [index defined on one property in datastore-indexes.xml file ] as per example “SELECT * FROM MESSAGE AS MESSAGE ORDER BY timestamp desc"

3>> Datastore query requires filtering based on complex query [index defined for complex query defind in datastore-indexes.xml file ] as per example "“SELECT * FROM MESSAGE AS MESSAGE WHERE req_id="xyz123" ORDER BY timestamp desc"

Note::for example purpose i have taken this statement “SELECT * FROM MESSAGE AS MESSAGE ORDER BY timestamp desc".This jpql query makes a get(1 read operation) http request in order to retrieve data from datastore.

Question

For above case scenario how New Entity Put write operation will be counted ?[ New Entity Put " 2 writes + 2 writes per indexed property value + 1 write per composite index value"]

thanks in advance!!!!

2

2 Answers

3
votes

For entities with single-valued properties, writing a new entity requires the following writes:

  • 1 for the entity itself
  • 1 for the EntitiesByKind index
  • 2 for each indexed property
  • 1 for each composite index

So for your examples:

  1. 1 + 1 + 2*(number of indexed properties)
  2. This is actually the same as #1; there's no need to define single-property indexes in datastore-indexes.xml as these are included automatically.
  3. 1 + 1 + 2*(number of indexed properties) + 1

Here's more information on Datastore write costs.

1
votes

My guess is

  1. 2 + 2 * n(number of indexed property: at least 1, timestamp) + 0
  2. 2 + 2 * n(number of indexed property: at least 1, timestamp) + 1(wrong. 0 is right)
  3. 2 + 2 * n(number of indexed property: at least 2, req_id, timestamp) + 1