[elephant-devel] Re: Getting count of the number of persistentobjects of a particular class

Joubert Nel joubert at joubster.com
Sat Jan 26 12:57:43 UTC 2008


On Mon, 2008-01-21 at 21:52 +0200, Alex Mizrahi wrote:
> 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 ^__^.

I'm not sure how many people desire such a function, but I think it is
certainly useful and something I want to leverage. I seems only BDB
would not support this...

Joubert





More information about the elephant-devel mailing list