If you&#x27;re making 300K queries over TCP to a database in order to do a calculation, then I&#x27;d say you need a <i>much</i> better data structure and&#x2F;or algorithm. Either that, or do the bulk of the calculations on the database in P&#x2F;T-SQL, or pre-calculate before-hand so that your on-line queries are just lookups instead of actual calculations.