[google-appengine] Re: How to solve the aggregate query with condition in Google App Engine

2012-08-01 Thread hyperflame
Well, you could just use Google Cloud SQL if you really want a SQL environment. Otherwise ( this is just a quick example, obviously there are some optimizations you could do). Also i'm typing this out on my phone, so forgive me if I miss a semicolon or something. To add a string to the datastore:

[google-appengine] Re: How to solve the aggregate query with condition in Google App Engine

2012-08-05 Thread Neo
Hi Hyperflame. Thanks for your reply. The problem is, between any given time period, there can be millions of such records. For each of such query, I will have to process those millions of records to get the top x entities. This is definitely very inefficient and not acceptable. -Neo On Thursd

[google-appengine] Re: How to solve the aggregate query with condition in Google App Engine

2012-08-05 Thread hyperflame
Instead of counting the number of times a string has appeared at querytime, just change to counting the number of times the string has been input at input-time. E.g. When your user puts in a string, search the datastore to see if that string already appears in an entity. If so, set the count prope

[google-appengine] Re: How to solve the aggregate query with condition in Google App Engine

2012-08-05 Thread Neo
Hi Hyperflame, Again, the problem with this strategy is that it gives the top 'n' items without considering time period - it is the absolute count of each string till date. It doesn't take into account the time period window. -- You received this message because you are subscribed to the Goog

[google-appengine] Re: How to solve the aggregate query with condition in Google App Engine

2012-08-06 Thread Joakim
I'd solve this by having one unique entity per combination of date and string, storing the string's total for that day in said entity. You can achieve this uniqueness either by formatting special entity names (string ids) to include both the date and the string. Aggregate the day's totals in an

[google-appengine] Re: How to solve the aggregate query with condition in Google App Engine

2012-08-06 Thread Neo
Hi Joakim , If I understand it correctly, the string-day entity would be something like this: Suppose there are 1 different strings S1, S2, ..., S1 on some particular day, each asked many a times in that day d1, then we will have 1 of entities: d1S1, d1S2, ...,d1S1. That means,

[google-appengine] Re: How to solve the aggregate query with condition in Google App Engine

2012-08-06 Thread Steve James
I'd say horses for courses on this one. IMHO the Datastore may not be the best fit to solving your requirement. Perhaps Cloud SQL or BigQuery might be better suited? Personally, i've consciously had to decide to make better use of all three; rather than hoping that Datastore'll solve all my nee

[google-appengine] Re: How to solve the aggregate query with condition in Google App Engine

2012-08-06 Thread hyperflame
On Aug 6, 1:14 am, Steve James wrote: > I'd say horses for courses on this one. > > IMHO the Datastore may not be the best fit to solving your requirement. > > Perhaps Cloud SQL or BigQuery might be better suited? Have to agree with Steve, this is increasingly sounding like a storage schema that

Re: [google-appengine] Re: How to solve the aggregate query with condition in Google App Engine

2012-08-06 Thread Rising India
Hi Joakim , If I understand it correctly, the string-day entity would be something like this: Suppose there are 1 different strings S1, S2, ..., S1 on some particular day, each asked many a times in that day d1, then we will have 1 of entities: d1S1, d1S2, ...,d1S1. That means, sup

Re: [google-appengine] Re: How to solve the aggregate query with condition in Google App Engine

2012-08-06 Thread Joakim
The string-day entities are only needed for the current day, as a way to parallel concurrent writes. In fact, it sounds like you will want to delete the day-string entities when they are no longer needed. The digested DayCount entity also described is the way to process queries, and will mean f

Re: [google-appengine] Re: How to solve the aggregate query with condition in Google App Engine

2012-08-07 Thread Neo
Hi Joakim, Thanks for the detailed reply. The problem is, though there will be only a single entity for each day, it may have thousands of string > count items. I will have to process all these string > count items. If we start aggregating each week and each month and so on, and find the larges