Bill, The docs say otherwise. count() on a query object returns a maximum of 1000. http://code.google.com/appengine/docs/python/datastore/queryclass.html#Query_count
Sharded counters are used to ease contention for highly updated objects but that doesn't downplay the need for counters. You need to either put a counter on a separate entity or create sharded counter if you want to count more than 1000 entities. Ian On Mon, Mar 2, 2009 at 5:40 PM, Bill <[email protected]> wrote: > > You can count well over 1000 objects -- the limitation is in the > fetching, but that's not the reason for sharded counters in Bloog. > > I wrote Bloog way back when App Engine was new and I was trying out > different "best practices" for datastore ops. Sharded counters are a > way to handle heavily-used counters, e.g. if the counter was getting > updated dozens of times per second. If you have that many increments/ > decrements on a counter, if you put the counter in a single integer > property, you'd start getting write contention. > > In retrospect, doing the sharded counter in Bloog was complete > overkill. It was useful to me at the time, because I was learning. > But the next version of Bloog will likely use a single integer > property for the counter and scrap the sharded counter. > -Bill > > On Mar 1, 9:11 pm, Ian Lewis <[email protected]> wrote: > > Krishna, > > > > The datastore can only return or count up to 1000 objects so if you have > > more than 1000 objects in the database you cannot count them without a > > counter. I assume the code in Bloog is keeping counts of objects in case > it > > runs up against this limitation. > > > > Ian > > > > > > > > On Mon, Mar 2, 2009 at 2:02 PM, Krishna <[email protected]> > wrote: > > > > > Ian, > > > > > I'm using some open source code (Bloog) and I don't really understand > > > how it works. So I'll trust your cautious approach although I don't > > > quite understand why something would need to "keep counts of objects > > > in the datastore". Best not to meddle although I was hoping to clean > > > things up if I could. > > > > > Thank you for responding. > > > Krishna > > > > > On Mar 1, 11:31 pm, Ian Lewis <[email protected]> wrote: > > > > Krishna, > > > > > > Anything you see in the data viewer is created by some application > code. > > > It > > > > wouldn't be put there by google appengine specifically. That said it > > > looks > > > > like something is using a sharded counter to keep counts of objects > in > > > the > > > > datastore or something similar. This data would not likely be > regenerated > > > if > > > > deleted, it would likely reset all the counters to zero so I would > leave > > > it > > > > alone. > > > > > > Ian > > > > > > On Mon, Mar 2, 2009 at 9:34 AM, Krishna <[email protected]> > > > wrote: > > > > > > > On the Data Viewer I have an entity called CounterShards. I > considered > > > > > deleting some extraneous data there but was afraid it would blow > > > > > something up. If I delete data here, will it be regenerated > > > > > automatically or should I leave it alone? > > > > > > -- > > > > ======================================= > > > > 株式会社ビープラウド イアン・ルイス > > > > 〒150-0012 > > > > 東京都渋谷区広尾1-11-2アイオス広尾ビル604 > > > > email: [email protected] > > > > TEL:03-5795-2707 > > > > FAX:03-5795-2708http://www.beproud.jp/ > > > > ======================================= > > > > -- > > ======================================= > > 株式会社ビープラウド イアン・ルイス > > 〒150-0012 > > 東京都渋谷区広尾1-11-2アイオス広尾ビル604 > > email: [email protected] > > TEL:03-5795-2707 > > FAX:03-5795-2708http://www.beproud.jp/ > > ======================================= > > > -- ======================================= 株式会社ビープラウド イアン・ルイス 〒150-0012 東京都渋谷区広尾1-11-2アイオス広尾ビル604 email: [email protected] TEL:03-5795-2707 FAX:03-5795-2708 http://www.beproud.jp/ ======================================= --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
