I have queries all working now, not quite where I want it yet, but there are still some optimizations to be done.
To insert 10000 objects into the database takes 8 seconds. To retrieve them using a two-test query takes 16 seconds. Not bad considering it was taking about a minute and a half the other day :-)