[Dev] Re: Chandler Query Proposal 0.1
Don Dwiggins
d.l.dwiggins at computer.org
Wed Feb 25 20:48:57 PST 2004
Ted Leung writes:
> I totally appreciate the desire for sizing information as way to improve the
> UI. Here are the two tradeoffs that I see.
> 1. We can design the system to start streaming items in the result set as
> soon as they are available. Since we don't know how many results there are
> (like how many people live in Oakland, CA) until the query finishes, we
> don't have the size information as the client starts consuming items from
> the generator. The advantage of this approach is that items are available
> for display immediately. We can also give you a rough hint of size by
> telling you something about the size of the root collection (e.g. there are
> 400,000 contacts, so the result will be smaller than that. In the case
> where we have computed selectivity statistics (something for down the line)
> we might be able to do even better -- the selectivity of this query
> predicate is 40%, so 40% of 400,000 is 160,000 which would be the estimate
> of the result size)
> 2. We can design the system to wait until the entire query result set has
> been computed, in which case we can give the precise size of the result.
> The disadvantage is that you have to wait till the entire query result is
> computed. In the case of large e-mail boxes, you might be waiting a while.
I've run into this tradeoff in developing database-backed web pages. You'd
like to show the first few results with a "page 1 of N" indication at the
bottom, and a way for users to go to individual pages or the next page. In
some cases, this causes an unacceptable wait time, so you give up on that
nice feature.
I think you need to offer both options, to allow the system's user (the
application programmer) to make the tradeoff. Of course, if you can give a
rough hint, that might be useful in some cases. (In the API I was using,
the result set object is specified so that the "number of rows" attribute is
only guaranteed accurate when the last row is accessed, either by iterating
through the rows or doing a "move to last" operation.)
--
Don Dwiggins "The truth will make you free,
d.l.dwiggins at computer.org but first it will make you miserable"
-- Tom DeMarco
More information about the Dev
mailing list