[elephant-devel] Re: Getting count of the number of persistentobjects of a particular class
Alex Mizrahi
killerstorm at newmail.ru
Mon Jan 21 19:52:19 UTC 2008
IE> Part of the problem with Elephant is that we currently create CLOS
IE> objects in memory for every 'row' that is touched in a query (or
IE> touched during an index operation). We have to de-serialize the
IE> record, create an object, initialize any transient slots, etc. The
IE> SQL engine, by contrast, can just keep track of a list of OIDs and
IE> then count the size of the arrays that result from any joins. This is
IE> a much cheaper set of operations per-row (i.e. per object). If we
IE> only read OIDs into memory until the final step when we need to access
IE> a slot, we can save quite a bit of the cost of object creation.
also backends which connect to database via a socket have considerable
communication overhead, i think it's even larger than deserialization
impact.
IE> My hope is that a query system would implement this model properly.
IE> Unfortunately, this will not happen soon, as much as I'm itching to do
IE> it!
OTOH it's fairly easy to make function that counts total number of entries
in btree or in some range, at least it's easy with db-postmodern -- it just
translates to COUNT(*) query.
if there is such a big demand for this feature, we can just implement it as
backend-specific advantage ^__^.
More information about the elephant-devel
mailing list