How to avoid this very heavy query that slows down the application?

前端 未结 9 634
日久生厌
日久生厌 2021-01-05 18:56

We have a web application running in a production enviroment and at some point the client complained about how slow the application got.

When we checked what was goi

相关标签:
9条回答
  • 2021-01-05 19:29

    All right, after months of looking at the thing, it turns out that the problem wasn't my web application. The problem was the other Oracle Forms applications that use the same instance (different user) of the database.

    What was happening was that the Oracle Forms applications were locking records on the database, therefore making pretty much all of the work of the database extremely slow (including my beloved Hibernate query).

    The reason of the locks was that none of the foreign keys of the Oracle Forms apps were indexed. So as my boss explained it to me (he discovered the reason) when a user is editing the master record of a master-detail relationship in a Oracle Form application, the database locks the entire detail table if there is no index for its foreign key. That is because the way the Oracle Forms works, that it updates all af the fields of the master record, including the ones of the primary key, wich are the fields that the foreign key references.

    In short, please NEVER leave your foreign keys without indexes. We suffered a lot with this.

    Thanks to all of you who took the time to help.

    0 讨论(0)
  • 2021-01-05 19:31

    This is coming from the default C3PO test query. Supply a simpler query in your configuration. Something like, select 'X' from dual.

    0 讨论(0)
  • 2021-01-05 19:33

    Is the sys schema in your 10g database analyze with updated stats? Have you collected stats on the fixed tables in the sys schema. Queries on all_objects shouldn't be that taxing to a system. If you run the query via autotrace/tkprof what/where is the major of the resources be spent at.

    0 讨论(0)
提交回复
热议问题