[Zope] Hardware for Zope + ZEO

Toby Dickenson tdickenson@geminidataloggers.com
Fri, 31 Jan 2003 09:26:17 +0000


On Friday 31 January 2003 8:40 am, Wankyu Choi wrote:
> On Friday 31 January 2003 7:17 am, Wankyu Choi wrote:


> --- code excerpt from NeoBoard ---
>
> def getArticles(...):
>
> ... prepare....
>
> articles =3D [article for article in board.ZopeFind( obj_metatypes=3D'N=
eoBoard
> Article' , search_sub=3D1)]
>
> # I use ZopeFind instead of objectValues since articles get nested
>
> ...sort articles...
> ...return articles...
>
> ---------------------------
>
> Note that my python/zope experience is limited. I'm still learning :-)
>
> Suppose the 'board' folderish object ( let's assume it's a BTreeFolder;=
 if
> it's present NeoBoard uses BTreeFolder2, otherwise Zope Folder ) holds
> about 10,000 articles.
>
> Whenever a list of articles gets displayed, this statement should be
> executed. Most RDBMS-based boards do the same with a select/limit combo
> like the PHP NeoBoard does:
>
> "SELECT article_field_list from board limit start_num, end_num"
>
> Am I missing something?

Yes.

Your SQL approach will access only the 50 relevent articles. The other 99=
50=20
stay untouched on disk.=20

Your ZODB approach loads all 10000 into memory, then your presentation lo=
gic=20
(I guess) ignores 99.5% of them.

> Is there a way in Zope to limit the returned
> results as a limit clause would do in an SQL statement?

The best approach is to use ZCatalog. ZCatalog means you only need to loa=
d the=20
articles into memory when you need them.



--=20
Toby Dickenson
http://www.geminidataloggers.com/people/tdickenson