I have a table called Balance with the following columns.
452 CHARACTER 2 FIRM_NBR 8
452 CHARACTER 8 ACCT_NBR 8
452 CHARACTER 1 ACCT_TYPE 9
485 DECIMAL 15, 2 TRADE_BALANCE 13
& some more colums
Each Customer(ACCT_NBR) may have 1 to 5 records for example
firm nbr acct nbr acct type trade balance
10 11111111 1 100000
10 11111111 2 200000
10 11111111 3 200000
10 11111111 c 200000
10 11111111 M 200000
This table contains 4 to 5 Million Records.
I have a requirement to pull all the accounts having sum(TRADE_BALANCE) > ?(may be $100)
SQL:
select acct_nbr from balance group by acct_nbr having sum(TRADE_BALANCE) > 100
SQL

Some times)
select acct_nbr from balance group by acct_nbr having sum(TRADE_BALANCE) > 100
and acct_nbr(list of acct_nbrs from some other table)
There will be 15000 users trying to get list of accounts with different sum(TRADE_BALANCE) value on the web.
This approach is causing contention on the database because of huge amount of data. I came to know that in db2 even select makes shared locks on the table.
I am thinking of implementing a table or view or some other mechanism having account number, sum(TRADE_BALANCE) of the account number as a batch process.
Any suggestions are wellcome.