fun database problem

Aaron Trevena aaron.trevena at
Mon Apr 30 14:06:25 BST 2007


I have an interesting little problem with a report I'm generating.

We want to show all the records (or rather objects in this case) that
meet certain general, and more specific criteria and show what records
that meet a subset of the criteria (i.e. date/location) didn't meet
the rest.

Currently I use an interator to filter out some of the results after
fetching and track how many were filtered out and by what field - of
course this is slower than just fetching only the records that will be
shown, but could be faster than mucking about running the query twice.

I was wondering if there was a better way to see what data wasn't
being fetched and why?

Maybe it's worth using a temporary table and fetching a subset from
that, and then counting what wasn't fetched from that temp table, as
it would be much much much smaller and therefore quicker to query than
the full data set.


It's more of an academic curiosity really - if users need to see how
many records were filtered out then I imagine they will allow a longer
time to generate the report - currently the report takes about 30
seconds and I'm guessing the post-fetch filtering is a couple of
seconds at most.



LAMP System Integration, Development and Hosting

More information about the mailing list