Search code examples
google-cloud-platformgoogle-cloud-datastorequery-optimizationdatastore

Comparing GCP datastore query performance


Are both the queries same in GCP datastore in terms of speed ?

If we run both the GCP datastore queries will they perform same in terms of speed ? Which will be faster ?

Query 1 :

q := datastore.NewQuery(CUSTOMER).
        Order("-CreatedOn").
        Filter("CustomerKey=", userKey)

Query2 :

q := datastore.NewQuery(CUSTOMER).
    Filter("CustomerKey=", userKey).
    Order("-CreatedOn")

Solution

  • These are the exact same query. The only difference is that you are building the query in a different order, but the RPC created is the exact same.