0

I have two tables 1-Employee & 2- LogHistory

Employee has child as LogHistory

There are lots of entries against for one employee in LogHistory

Employe has properties employeeId, name, email and LogHistory list.

LogHistory has properties logindateTime, action, status, employeeId.

I want to query on condition with status to LogHistory and get Employee Object.

And want to use it in batch query because there are lots of entries in LogHistory so that can not fetch all data once otherwise it will increase latency.

Due to fetching all data in Query will cause slowness performance. May be in future table will have millions of data.

So please provide me any better solution WRT cloud data store so that i can get data in batch with single query or filter etc and also get all counts.

Current Scenario is:
In above case I am using JDO datastore with one to many relation & getting Employee Objects by LogHistory with status condition.
After Query:
LogHistory has Employee Object and only taking single Employee Object(By removing duplicate Employee).

But now I have much data so it is causing slowness and increasing latency.

Is there anyway or using low level API for the above scenario to get data by query so that i can also apply batch etc?

Ashraf
  • 135
  • 10
  • It sounds like you're looking for a tutorial on using the App Engine datastore or [NoSQL datastores](https://en.wikipedia.org/wiki/NoSQL) more generally. [This post](http://bjk5.com/post/54202245691/the-app-engine-way) provides a pretty good intro to the importance of denormalization. The App Engine docs on [Sharding Counters](https://cloud.google.com/appengine/articles/sharding_counters) offer insight into some of the special challenges presented by large scalable datastores when it comes to aggregation and batch operations. – Chapman Atwell Dec 20 '17 at 23:39
  • @ChapmanAtwell Thanks. No I am not looking tutorial of App Engine datastore.In My problem actually I want parent object by child object through in a single query based on some condition or property match as given "status" of LogHistory. In normalized DB there is an option of JOIN in SQL it can be done but In case of App Engine datastore it is not. So I want a query that just make a join type to get Employee Object by Child Object on some condtion. So that i can apply a batch also for that query in huge data fetching. – Ashraf Dec 21 '17 at 03:52
  • 1
    If I understand your question correctly, ["The App Engine Way" post](http://bjk5.com/post/54202245691/the-app-engine-way) addresses it with the monkeys and zoos examples. In the NoSQL non-relational world, it recommends simply including any employee data you need in the LogHistory record to avoid the join query. – Chapman Atwell Dec 21 '17 at 19:24
  • @ChapmanAtwell I have gone through this article but right now i huge data in both tables as relation one to many i can not copy or inset all data from one entity into 2nd entity and query from one entity as desired. It will be very hard. So I am asking is there any way even using Low level API in cloud datastore. In my case I am using JDO with relation One to Many type. – Ashraf Dec 22 '17 at 04:14
  • 1
    I'm not aware of any low level API. I suspect you will need to come up with some sort of creative workaround. If latency is the primary issue, have you considered a background task or cron job to transform the data to a state more amenable to your needs? – Chapman Atwell Dec 27 '17 at 17:35

0 Answers0