Is it possible to collect object usage information during compilation?

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 10 04:52:42 PST 2015


On 2015-01-10 13:36, Martin Nowak wrote:

> The idea isn't bad, but the performance will suck. This is generally
> known as N+1 query, only that this is even worse, as each field is
> queried individually.

Since the "all" method was called I would assume all rows in the person 
table are fetched in one single query. Although I don't know if that 
will work if not the whole row should be loaded.

> Here is a sketch for an optimal solution. I'm actually eagerly waiting
> that someone finally implements it.
>
> http://dpaste.dzfl.pl/cd375ac594cf

How would you handled fetching multiple rows and a foreach loop, i.e. my 
example?

Perhaps a detail but using a wrapped type instead of the raw types in 
Person you could handle things like null in the database.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list