http://www.perlmonks.org?node_id=688643


in reply to A profiling surprise ...

The first thing you should do is to check that the DB queries you issue are efficient. With Sybase this means setting the SHOWPLAN and STATISTICS IO options, and checking to make sure that all accesses are done via indexes (no table scans for actual physical tables), and that the query plans make sense.

The second thing is to see if the data fetch algorithm can be improved to reduce the amount of work needed to find the appropriate data. DB engines are optimized (and incredibly efficient) at finding data given a set of criteria and proper indexes/joins between tables - making use of that power can improve overall speed by several orders of magnitude (just as dragonchild mentioned above)

Michael