[google-appengine] Re: Getting total count from datastore

2008-11-02 Thread David Symonds

On Sun, Nov 2, 2008 at 11:58 AM, monmonja <[EMAIL PROTECTED]> wrote:

> Now i don't know if this is the best way of doing it but it does not
> require you to do some writing on datastore and it uses memcache, if
> there is a better way of doing this please stress out. Thanks. :)

That's a terrible way of doing this: (a) possibly inaccurate, and (b)
unscalable. The correct way to implement such a global counter is via
something like a sharded counter that you increment each time you add
an entity and decrement each time you remove an entity.


Dave.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Getting total count from datastore

2008-11-03 Thread Dan Sanderson
See also the docs on fetch(limit, offset):
http://code.google.com/appengine/docs/datastore/queryclass.html#Query_fetch

In particular: "The query has performance characteristics that correspond
linearly with the offset amount plus the limit."

-- Dan

On Sun, Nov 2, 2008 at 8:23 PM, David Symonds <[EMAIL PROTECTED]> wrote:

>
> On Sun, Nov 2, 2008 at 11:58 AM, monmonja <[EMAIL PROTECTED]> wrote:
>
> > Now i don't know if this is the best way of doing it but it does not
> > require you to do some writing on datastore and it uses memcache, if
> > there is a better way of doing this please stress out. Thanks. :)
>
> That's a terrible way of doing this: (a) possibly inaccurate, and (b)
> unscalable. The correct way to implement such a global counter is via
> something like a sharded counter that you increment each time you add
> an entity and decrement each time you remove an entity.
>
>
> Dave.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Getting total count from datastore

2008-11-06 Thread monmonja

Thanks for your input, i already warn people going to the post to use
shared counters. Btw do you have a simple example of it, and what if i
want to count based on a query, say all blog post within july, how can
i count it so that it could scale? Tnx again

On Nov 4, 2:41 am, Dan Sanderson <[EMAIL PROTECTED]> wrote:
> See also the docs on fetch(limit, 
> offset):http://code.google.com/appengine/docs/datastore/queryclass.html#Query...
>
> In particular: "The query has performance characteristics that correspond
> linearly with the offset amount plus the limit."
>
> -- Dan
>
> On Sun, Nov 2, 2008 at 8:23 PM, David Symonds <[EMAIL PROTECTED]> wrote:
>
> > On Sun, Nov 2, 2008 at 11:58 AM, monmonja <[EMAIL PROTECTED]> wrote:
>
> > > Now i don't know if this is the best way of doing it but it does not
> > > require you to do some writing on datastore and it uses memcache, if
> > > there is a better way of doing this please stress out. Thanks. :)
>
> > That's a terrible way of doing this: (a) possibly inaccurate, and (b)
> > unscalable. The correct way to implement such a global counter is via
> > something like a sharded counter that you increment each time you add
> > an entity and decrement each time you remove an entity.
>
> > Dave.
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Getting total count from datastore

2008-11-20 Thread [EMAIL PROTECTED]

what about of using Ajax for dynamic (such as using users parameters)
and complicated counts ? I mean, to leave to JS the responsibility of
summing data that GAE will calculate in bulk of 1000 ? I know you
will have the overhead of 1 call for every 1000 records... but at
least you wont risk of getting your process consuming more than the
quota limit of 10 seconds !!! And the user could see some kind of
"nice" progress bar

On 6 nov, 18:52, monmonja <[EMAIL PROTECTED]> wrote:
> Thanks for your input, i already warn people going to the post to use
> shared counters. Btw do you have a simple example of it, and what if i
> want tocountbased on a query, say all blog post within july, how can
> icountit so that it could scale? Tnx again
>
> On Nov 4, 2:41 am, Dan Sanderson <[EMAIL PROTECTED]> wrote:
>
> > See also the docs on fetch(limit, 
> > offset):http://code.google.com/appengine/docs/datastore/queryclass.html#Query...
>
> > In particular: "The query has performance characteristics that correspond
> > linearly with the offset amount plus the limit."
>
> > -- Dan
>
> > On Sun, Nov 2, 2008 at 8:23 PM, David Symonds <[EMAIL PROTECTED]> wrote:
>
> > > On Sun, Nov 2, 2008 at 11:58 AM, monmonja <[EMAIL PROTECTED]> wrote:
>
> > > > Now i don't know if this is the best way of doing it but it does not
> > > > require you to do some writing ondatastoreand it uses memcache, if
> > > > there is a better way of doing this please stress out. Thanks. :)
>
> > > That's a terrible way of doing this: (a) possibly inaccurate, and (b)
> > > unscalable. The correct way to implement such a global counter is via
> > > something like a sharded counter that you increment each time you add
> > > an entity and decrement each time you remove an entity.
>
> > > Dave.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---