-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

> I'm already on my 3rd attempt at optimization for this section.  The
>  first round was having the db do _all_ the work, submitting a
> complex query (a view, actually) and returning a resultset with all
> the data I need. The query took forever, and the java code to produce
> the report was really fast.

I would bet on the speed of the (properly indexed and tuned) database
against Java any day, honestly. These things were built to perform these
types of requests. No offense to your abilities, but have you had a DBA
check out your tables and indexes to see if they are properly supporting
the queries you are attempting to execute? It's easy to write a
long-running query, but just a few tweaks can reduce the query time by
orders of magnitude.

> One issue I ran into earlier today with plain HashMaps was that I 
> couldn't figure out how to search for a specific piece of data, which
>  requires matching on a site number, a date and a shift, and for some
>  data another date.

Right: you need to hash the 3 data items together. Typically, you would
write a class that bundles the 3 data together and provides a hashCode
method that incorporates them and an equals method that checks them.
Then, use that as the key to your map. Is there any reason why you can't
use the data objects themselves in this way?

map.put(myDataObj, myDataObj)?

> I have a workable solution right now, though the code is rather more
> complex than I would like to keep my navigation of all those TreeMaps
> in sync.

When in doubt, abstract: write yourself a helper class that bundles all
this odd logic together. Then, your business code will be a lot simpler
to read, and you can separately unit test your
SpecializedTreeSetHashMapLinkedList class (or whatever). ;)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHX/sQ9CaO5/Lv0PARAjN0AJ9tgdFORyqM8VdGJjoWj50Ihvw0UgCgg8wN
+JCz1Ve/reJXVRGw8mPvrZY=
=bJvv
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to