Google App Engine Database Index

I need to store an undirected graph in a Google App Engine database. For optimization purposes, I am thinking of using database indexes . Using Google App Engine, is there a way to define the columns of the database table to create my index?

I will need optimization as my application uses this stored undirected graph to filter content for position recommendation. In addition, the recommendation algorithm updates the weights of some of the graphs in the graph.

If you cannot use database indexes, suggest another method to reduce query time for the chart table. I believe that my algorithm does more searches for data from the chart table than it does writes.

PS: I am using Python.

+2


a source to share


2 answers


+3


a source


Are you really seeing prohibitively slow queries? I don't think not. I suspect this is a premature optimization. no sorting, filtering, merging, or other meaningful in-memory operations take place in the application data store, so query times are usually fairly constant. in particular, query latency does not depend on the number of objects in your datastore, or even on the number of objects that match your query. it only depends on the number of results you are asking for.

in a related note, adding indexes to the datastore will not speed up existing queries. if a query needs a custom index, it won't degrade and run slower without it. the query simply won't run until you add the index.



for the specific query you mentioned, the select * from edges where vertex1 == x and vertex2 == y

datastore can run it without a special index. see this section of the documentation for more details .

just run the queries you want and don't think too much about indexes or try to optimize as if you were a DBA. it is not a relational database.: P

+1


a source







All Articles