Hi,
we are building a Java webapplication using JSF, running on websphere,
querying a DB2 9 on Suse Enterprise 10. The app uses JDBC and
PreparedStateme nts only (aka dynamic SQL). Every night, there is a ETL
which deletes most of the data in the database and fills it all new.
We observed very bad performance for some statements that ran for
minutes (The queried table is about 100,000 records and the result is
about 500 rows). Executing the same SQL in the control center took
round about 30 ms. After a while we realized that the difference
between our app and the control center, and some other tools we used
to execute the same query, is the use of dynamic and static SQL. We
change the source code to static SQL by removing all the wildcards and
putting the parameters right in the SQL-String and viola the
performance was good.
That all seems to me, like there is a problem with the execution plans
or something like this and by using static sql, we force it to
recalculate the plans for the given statement. I already tried to
clear the package cache by invoking "flush package cache dynamic" but
had no luck.
My questions are:
1. Does my theory sounds plausible?
2. How to get rid off the bad execution plans?
3. Why there are bad execution plans? Is this because we reimport all
the data every night?
Thanks for your help!
Cheers,
Tim
we are building a Java webapplication using JSF, running on websphere,
querying a DB2 9 on Suse Enterprise 10. The app uses JDBC and
PreparedStateme nts only (aka dynamic SQL). Every night, there is a ETL
which deletes most of the data in the database and fills it all new.
We observed very bad performance for some statements that ran for
minutes (The queried table is about 100,000 records and the result is
about 500 rows). Executing the same SQL in the control center took
round about 30 ms. After a while we realized that the difference
between our app and the control center, and some other tools we used
to execute the same query, is the use of dynamic and static SQL. We
change the source code to static SQL by removing all the wildcards and
putting the parameters right in the SQL-String and viola the
performance was good.
That all seems to me, like there is a problem with the execution plans
or something like this and by using static sql, we force it to
recalculate the plans for the given statement. I already tried to
clear the package cache by invoking "flush package cache dynamic" but
had no luck.
My questions are:
1. Does my theory sounds plausible?
2. How to get rid off the bad execution plans?
3. Why there are bad execution plans? Is this because we reimport all
the data every night?
Thanks for your help!
Cheers,
Tim
Comment