The Java Importer Performance Analysis Tools

Diagnosing and Tuning Oracle Reports 24-37 END IF; You can define a query based either on an XML or a Text pluggable data source by selecting the fields to be used in the query that is, all available fields or a subset. If you must use a subset of the fields, do so at the query level using parameters, as opposed to fetching all the values and filtering them using a group filter or layout level format triggers.

24.5.5 Break Groups

Limit the number of break groups to improve your reports performance. Oracle Reports sets the break level for each column in the data model that has the break order property set except the lowest child group. For a SQL query, Oracle Reports appends this as an extra column to the ORDER BY clause in the query. The fewer columns in the ORDER BY clause, the less work the database has to do before returning the data in the required order. Creating a break group may render an ORDER BY clause redundant in spite of defining it as part of the query. Remove any such ORDER BY clauses as it requires extra processing by the database. If your report requires the use of break groups, set the Break Order property for as few columns as possible. A break order column is indicated by a small arrow to the left of the column name in the group in the Reports Builder Data Model View. Each break group above the lowest child group of a query requires at least one column to have the Break Order property set. Removing the break order from columns where sorting is not required increases performance. Limit break groups to a single column whenever possible. These columns should be as small as possible and be database columns as opposed to summary or formula columns wherever feasible. Both conditions help the local caching that Oracle Reports does, before the data is formatted for maximum efficiency. Clearly, these conditions cannot always be met but can increase efficiency whenever utilized.

24.5.6 Group Filters

Group filters reduce the number of records displayed. Filtering takes place after the query returns the data from the data source to Oracle Reports. Even if the filter is defined to display only the top five records, the result set will contain all the records returned by the query. Hence, it is more efficient to incorporate the group filter functionality into the querys WHERE clause or into the Maximum Rows property, whenever possible. This restricts the data returned by the database.

24.5.7 To Link or Not To Link

There are a number of ways to create data models that include more than one table. Consider the standard case of the deptemp join, with the requirement to create a report that lists all the employees in each department in the company. You can create either of the following: Note: The only meaningful place to use the SRW.SET_MAXROW built-in procedure is in the Before Report trigger after the query has been parsed. Calling the SRW.SET_MAXROW built-in procedure after this point raises the SRW.MAXROW_UNSET built-in exception. The query will still be parsed and bound, but no data will be returned to the report. 24-38 Publishing Reports to the Web with Oracle Reports Services ■ Single query: SELECT d.dname, e.ename FROM emp e, dept d WHERE e.deptno+ = d.deptno ■ Two queries with a column link based on deptno: SELECT deptno, dname FROM dept SELECT deptno, ename FROM emp When you design the data model in the report, minimize the actual number of queries by using fewer large multitable queries, rather than several simple single-table queries. Every time a query is run, Oracle Reports needs to parse, bind, and execute a cursor. A single query report returns all the required data in a single cursor, rather than many cursors. With master-detail queries, the detail query will be parsed, bound, and executed again for each master record retrieved. In this example, it is more efficient to merge the two queries and use break groups to create the master-detail effect. Keep in mind that the larger and more complex a query gets, the more difficult it is to be maintained. You must decide when to achieve the balance between performance and maintenance requirements.

24.6 Formatting the Data

After the data is retrieved from the data source, Oracle Reports generates the report layout and formats the output. The time taken for a paper layout depends on a number of factors, but generally comes down to: ■ The work required to prevent an object from being overwritten by another object. ■ The efficiency of any calculations or functions performed in the format triggers. The rules for a Web layout are a little different as Oracle Reports does not own the Web page or control the rendering mechanism. It merely injects data into a regular JSP page. This section discusses reviewing and tuning the format of your report: ■ Paper Layout including Format Triggers and Image Outputs ■ Web Layout and JSP Report Definition

24.6.1 Paper Layout

When generating a default paper layout, Oracle Reports places a frame around virtually every object to prevent the object from being overwritten by another object. At runtime, every layout object frames, fields, boilerplate, and so on is examined to determine the likelihood of that object being overwritten. In some situations for example, boilerplate text column headings when there is clearly no risk of the objects being overwritten, the immediately surrounding frame is removed. This reduces the number of objects that Oracle Reports must format and consequently, improves performance. An object that is defined as variable, expanding, or contracting in either or both the horizontal or vertical directions requires extra processing. In this case, Oracle Reports must determine the instance of the objects size, before formatting that object and those around it. There is no processing overhead involved for objects assigned a fixed size, as the size and positional relationships between the objects is known. The following guidelines helps to improve performance when creating a paper layout: