0% found this document useful (0 votes)
8 views

BI_Query_Tuning_Best_Practices

The document outlines best practices for writing BI Publisher (BIP) reports and performant SQL queries, emphasizing the importance of returning only necessary data, using column aliases, and avoiding complex queries. It recommends generating explain plans to analyze SQL performance and offers guidelines for optimizing SQL statements, such as avoiding full table scans and using SQL hints. Additionally, it provides links to specific tuning guides for various Oracle database releases.

Uploaded by

bala nagella
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

BI_Query_Tuning_Best_Practices

The document outlines best practices for writing BI Publisher (BIP) reports and performant SQL queries, emphasizing the importance of returning only necessary data, using column aliases, and avoiding complex queries. It recommends generating explain plans to analyze SQL performance and offers guidelines for optimizing SQL statements, such as avoiding full table scans and using SQL hints. Additionally, it provides links to specific tuning guides for various Oracle database releases.

Uploaded by

bala nagella
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

FA-SAAS

SQL Guardrail
Initiative
Best Practices for Writing BIP Reports
1. SQL Dataset:
• Only Return the Data You Need
• Use Column Aliases to Shorten XML File Length
• Avoid Using Group Filters in Data Model. Instead enhance Your Query
• Avoid PL/SQL function Calls in WHERE Clauses
• Avoid Use of the System Dual Table
• Avoid PL/SQL Calls at the Element Level
• Avoid Including Multiple Data Sets
• Avoid Nested Data Sets
• Avoid In-Line Queries (as summary columns)
• Avoid Excessive Parameter Bind Values
• The number of columns selected in SQL should not exceed 100
• Sorting should be done in the SQL, not during report formatting
• Avoid having WHERE clause on large tables with only NOT IN or <>

Copyright © 2019 Oracle and/or its affiliates.


Best Practices for Writing BIP Reports
2. Use datamodel ”Validate” option to get set of Saffron-like checks for BI reports.

3. Generate Explain Plan

Oracle BI Publisher provides a mechanism to generate the explain plan, SQL monitoring reports and to enable SQL
session trace. This functionality is applicable to SQL statements executing against Oracle Database only. Logical
queries against BI Server or any other type of database are not supported.

Copyright © 2019 Oracle and/or its affiliates.


Best Practices for Writing BIP Reports
• Generate an explain plan at the data set level for a single query

• Generate an explain plan at the report level for all queries in a report

Copyright © 2019 Oracle and/or its affiliates.


Best Practices for Writing Performant SQLs
1. Analyze the explain plan. Use an execution plan with runtime stat. Things to watch for:
• Big runtime or resource consumers in the plan.
• Sub plans that execute multiple times.
• The estimate rows and actual rows differ significantly.
2. Add required filter conditions and remove unwanted joins and tables.
3. Avoid and remove full table scans (FTS) on large tables. In some cases, full table scans on
small tables are faster and improve query fetching.
4. Use SQL hints to force the use of proper indexes.
5. Avoid complex subqueries and use subquery factoring/common table expression (with
clause) where necessary.
6. Use Oracle SQL Analytical functions for multiple aggregations.
7. Avoid too many subqueries in WHERE clauses, if possible. Instead, rewrite queries with outer
joins.
8. Avoid group functions like HAVING and IN / NOT IN WHERE clause conditions.
9. Use CASE statements and DECODE functions for complex aggregate functions.
10. Test, test, test again.

Copyright © 2022 Oracle and/or its affiliates.


Best Practices for Writing Performant SQLs
For more details on tuning, refer to your database version-specific tuning guides:

• Release 12.2 https://docs.oracle.com/en/database/oracle/oracle-


database/12.2/tgsql/introduction-to-sql-tuning.html

• Release 18 https://docs.oracle.com/en/database/oracle/oracle-
database/18/tgsql/introduction-to-sql-tuning.html

• Release 19 https://docs.oracle.com/en/database/oracle/oracle-
database/19/tgsql/introduction-to-sql-tuning.html

• Release 21 https://docs.oracle.com/en/database/oracle/oracle-
database/21/tgsql/introduction-to-sql-tuning.html

Copyright © 2022 Oracle and/or its affiliates.


Thank you!

You might also like