Do not compute number of rows until it is needed.
__len__ should be the only public way to get number of rows.
Consider where clause when computing distributions.
Queryies with offset but no limit.
Fixed a failing test.