I have an Android app where users will be able to send private messages to each other. (for instance: A sends a message to B and C and the three of them may comment that message)
I use google app engine and the google datastore with Java. (framework Objectify)
I have created a Member
entity and a Message
entity which contains a ArrayList<String>
field, representing the recipients'ids list. (that is to say the key field of the Member
entity)
In order for a user to get all the messages where he is one of the recipients, I was planning on loading each Message
entity on the datastore and then select them by checking if the ArrayList<String>
field contains the user's id. However, considering there may be hundred of thousands messages stored, I was wondering if that is even possible and if that wouldn't take too much time?
Datastore is designed to support transactional workloads, such as the backend for a web application. It's optimized for small transactions that read or write a limited number of rows per operation, with strong consistency guarantees. BigQuery is designed for analytic workloads.
The Python Datastore API provides two classes for preparing and executing queries: Query uses method calls to prepare the query. GqlQuery uses a SQL-like query language called GQL to prepare the query from a query string.
How can you reduce latency when adding expenses to Cloud Datastore? Use a batch operation to add multiple entities in one request. An employee can have multiple expense exports and each expense report can have multiple expenses.
Datastore is a highly scalable NoSQL database for your web and mobile applications.
The time to fetch results from the datastore only relates to the number of Entities retrieved, not to the total number of Entities stored because every query MUST use an index. That's exactly what makes the datastore so scalable.
You will have to limit the number of messages retrieved per call and use a Cursor to fetch the next batch. You can send the cursor over to the Android client by converting it to a websafe string, so the client can indicate the starting point for the next request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With