-1 (horizontal) (eager) loading ONLY of the needed row attributes,
also hierarhicaly (a.b.c.d)
-2 (vertical) simultanously loading of columns - e.g. the lazy
attribites - wholly, or in portions/slices (depending on UI
visibility or other slice-size)
-3 skipping creation of objects - only using the data, if time of
creation gets critical. For example a simple report for a name.alias
and age of person, the creation of 100,000 Persons can be ommitted.
To be able to do drill-down, the person.db_id would be needed+stored
too.
-4 cacheing of some aggregations/calculations in special
columns/tables, so they're not re-invented everytime
-5 translate the whole report - calculations, aggregations, grouping
etc. into sql and use the result as is (with same thing about
db_id's)
and combination of above, in whatever subset.
i've done something about aggregation/4 with Paul Colomiets, see last
development at
http://www.mr-pc.kiev.ua/en/projects/SQLAlchemyAggregator/
But there's more to it, as i want it completely transparent and
switchable (on/off).
i'd be most interested in 7/ last one, but as i see the trend, very
very few people look a level higher than plain sql expressions (and
_want_ all the sql-dependencies that follow from that), what to say
about translations of meta-info...
on the way further, we'll probably have more of these invented, unless
someone does it first, which would be very welcome...
ciao
svilen
you might want to look into creating views for each thing that you
need to select, thus moving the complexity of fine tuning the joins
over to the database side.
> How much time is generally spent by SA if let's say we have a
> 1,000,000 rows returned and this resultset will form the whole
> heirarchy i.e. A (main entity) A.b, A.c [] (a list) , A.c.d []
> (again a list) etc. ? Is that a considerable time ?
well u just sum how many constructors has to be executed - per row,
multiply by million... IMO anything in python mutiplied by million is
considerable time. Maybe in 10 years it will be not. Thats why i want
to keep my model separate from the denormalization scheme.
> What is the best optimization technique followed (recommended by SA
> ORM) when it comes to aggregation of data from multiple tables with
> lots of rows in it (and continuously growing) ?
SA 0.4 can do query polymorphisms by multiple per-subtype queries, but
i have no idea how that works or how much better it is than one huge
union/leftouterjoin + the type-switching over it, + u'll miss overall
the ordering.
Mike, can this mechanism be used somehow for my "vertical" loading,
i.e. some load "column" from some related table that is not in the
polymorhistic hierarchy?
> i thought so earlier but unfortunately i am on a lower version of
> mysql :(
upgrade.