[Zope] ZCatalog query optimisation
Casey Duncan
casey@zope.com
Mon, 4 Nov 2002 13:21:31 -0500
There are no real general optimizations to be made but here are some=20
suggestions.
One thing to consider would be to consolidate a query involving multiple=
=20
indexes to a single FieldIndex by precomputing and combining the values o=
f=20
the other indexes together. The 2.6 TopicIndexes are a built-in facility =
for=20
this, but you can just use a python script and a FieldIndex to approximat=
e=20
the same thing on earlier zopes.
Of course that really only helps FieldIndexes, and maybe KeywordIndexes=20
(depending on usage).
Also, if you are using 2.6, there is a new DateRange index which is an=20
optimization for searching for things falling between two dates. It shoul=
d be=20
much faster then search two FieldIndexes. 2.6 as has a DateIndex which is=
=20
more efficient at indexing dates then a FieldIndex, it keys on a lower da=
te=20
resolution so the index should be smaller and faster to query.
Another option would be to put some sort of caching in front of the Catal=
og to=20
avoid repeating the same queries too often. In zope this might be done wi=
th a=20
python script that performs the query bound to a RAM cache manager (this=20
would be good if the query is shared by several pages or the pages themse=
lves=20
are uncachable) or just general caching on the pages displaying the queri=
es=20
using HTTP cache managers and squid or apache.
hth,
-Casey
On Monday 04 November 2002 09:52 am, Thierry Florac wrote:
> Hi...
>=20
> I have a quite big ZCatalog, on which I have to make several queries
> including several indexes.
> Is there any way to optimize such queries (query parameters order, inde=
x
> types,...) ??
>=20
> Thanks for any advise.
>=20
> Thierry
>=20
>=20
> --=20
> Linux every day, keeps Dr Watson away...
> http://gpc.sourceforge.net -- http://www.ulthar.net