Oracle Application Express Schema Design Guidelines Presenter: Flavio Casetta, Yocoya.com

Similar documents
ORACLE DATABASE 12C INTRODUCTION

Oracle APEX 18.1 New Features

Database Developers Forum APEX

Sql Server Check If Global Temporary Table Exists

Data Warehouse Tuning. Without SQL Modification

Oracle Transparent Gateways

ORACLE TRAINING CURRICULUM. Relational Databases and Relational Database Management Systems

Teradata. This was compiled in order to describe Teradata and provide a brief overview of common capabilities and queries.

CIB Session 12th NoSQL Databases Structures

<Insert Picture Here> DBA Best Practices: A Primer on Managing Oracle Databases

MTA Database Administrator Fundamentals Course

Performance Optimization for Informatica Data Services ( Hotfix 3)

Oracle PL/SQL - 12c & 11g [Basic PL/SQL & Advanced PL/SQL]

Module 9: Managing Schema Objects

Manual Trigger Sql Server 2008 Insert Multiple Rows At Once

Seminar: Presenter: Oracle Database Objects Internals. Oren Nakdimon.

Data Warehousing 11g Essentials

Oracle Application Express Workshop I Ed 2

Oracle Database 11g: SQL Tuning Workshop

Oracle Application Express: Administration 1-2

20 Essential Oracle SQL and PL/SQL Tuning Tips. John Mullins

SQL Gone Wild: Taming Bad SQL the Easy Way (or the Hard Way) Sergey Koltakov Product Manager, Database Manageability

Building Database-Centric Web Applications Using. Oracle HTML DB

Greenplum Architecture Class Outline

Oracle BI 11g R1: Build Repositories

Microsoft. [MS20762]: Developing SQL Databases

5. Single-row function

1 Dulcian, Inc., 2001 All rights reserved. Oracle9i Data Warehouse Review. Agenda

The NoPlsql and Thick Database Paradigms

Developing SQL Databases

<Insert Picture Here>

DATABASE PERFORMANCE AND INDEXES. CS121: Relational Databases Fall 2017 Lecture 11

Design Sql Server Schema Comparison Tools 2012

DBAs can use Oracle Application Express? Why?

1 Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Mysql Performance Schema Has The Wrong Structure

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Copyright 2018, Oracle and/or its affiliates. All rights reserved.

Learning Objectives : This chapter provides an introduction to performance tuning scenarios and its tools.

Db2 9.7 Create Table If Not Exists >>>CLICK HERE<<<

Analytics: Server Architect (Siebel 7.7)

IBM Operational Decision Manager Version 8 Release 5. Configuring Operational Decision Manager on WebLogic

20762B: DEVELOPING SQL DATABASES

<Insert Picture Here> Oracle SQL Developer: PL/SQL Support and Unit Testing

Oracle Application Express

SQL Server Development 20762: Developing SQL Databases in Microsoft SQL Server Upcoming Dates. Course Description.

Toad for Oracle Suite 2017 Functional Matrix

SQL Azure. Abhay Parekh Microsoft Corporation

What s New In Sawmill 8 Why Should I Upgrade To Sawmill 8?

Manipulating Database Objects

Real Application Security Administration

1Z Oracle Business Intelligence (OBI) Foundation Suite 11g Essentials Exam Summary Syllabus Questions

Top 20 Data Quality Solutions for Data Science

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Oracle Join Tables Across Database Link

7. Query Processing and Optimization

1. Attempt any two of the following: 10 a. State and justify the characteristics of a Data Warehouse with suitable examples.

Oracle Performance Tuning. Overview of performance tuning strategies

Course Contents of ORACLE 9i

Jyotheswar Kuricheti

APEX Times Ten Berichte. Tuning DB-Browser Datenmodellierung Schema Copy & Compare Data Grids. Extension Exchange.

An Oracle White Paper September Security and the Oracle Database Cloud Service

An Oracle White Paper April Oracle Application Express 5.0 Overview

Proje D2K. CMM (Capability Maturity Model) level Project Standard:- Corporate Trainer s Profile

Oracle Compare Two Database Tables Sql Query List All

I, J, K. Lightweight directory access protocol (LDAP), 162

Data about data is database Select correct option: True False Partially True None of the Above

Table of Contents. PDF created with FinePrint pdffactory Pro trial version

Oracle Database: SQL and PL/SQL Fundamentals NEW

SQL Server Reporting Services

Using SQL Developer. Oracle University and Egabi Solutions use only

SQL Coding Guidelines

Oracle Alter Table Add Primary Key Using Index

Teiid Designer User Guide 7.5.0

Eternal Story on Temporary Objects

How to choose the right approach to analytics and reporting

Pl Sql Copy Table From One Schema To Another

1Z0-526

EBS Reports and Dashboards for the People and by the People

Oracle Fusion Middleware 11g: Build Applications with Oracle Forms

APEX Performance Analyse

Designing dashboards for performance. Reference deck

Query To View Table Structure In Sql Server 2008

"Charting the Course... MOC C: Developing SQL Databases. Course Summary

<Insert Picture Here> MySQL Cluster What are we working on

IBM. Database Database overview. IBM i 7.1

Microsoft Developing SQL Databases

Apache Hive for Oracle DBAs. Luís Marques

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Creating Enterprise and WorkGroup Applications with 4D ODBC

Jet Data Manager 2014 SR2 Product Enhancements

Upgrading to MySQL 8.0+: a More Automated Upgrade Experience. Dmitry Lenev, Software Developer Oracle/MySQL, November 2018

MSBI (SSIS, SSRS, SSAS) Course Content

Beyond Relational Databases: MongoDB, Redis & ClickHouse. Marcos Albe - Principal Support Percona

CHAPTER. Oracle Database 11g Architecture Options

Chapter 1: Introducing SQL Server

Oracle Warehouse Builder. Oracle Warehouse Builder. Quick Start Guide. Jean-Pierre Dijcks, Igor Machin, March 9, 2004

11G ORACLE DEVELOPERS Training Program

Rajiv GandhiCollegeof Engineering& Technology, Kirumampakkam.Page 1 of 10

Oracle BI 11g R1: Build Repositories

Transcription:

Oracle Application Express Schema Design Guidelines Presenter: Flavio Casetta, Yocoya.com

about me Flavio Casetta Founder of Yocoya.com Editor of blog OracleQuirks.blogspot.com 25+ years in the IT 10+ years developing applications on Oracle 15+ years developing database applications apex developer since htmldb 1.5

goals summary db objects mapping to apex components tables, views, indexes performance packages vs standalone procedures snapshots or cached reports? synonyms and db links Q&A June 24, 2009 Flavio Casetta - www.yocoya.com 3

goals June 24, 2009 Flavio Casetta - www.yocoya.com 4

the goals of every apex developer should be to build fast, scalable applications that are easy to use, deploy and maintain to avoid reinventing the wheel goals to avoid writing the same code over and over again the aim of this presentation is to stress the importance of proper database design as a strong foundation for your apex applications June 24, 2009 Flavio Casetta - www.yocoya.com 5

db objects mapping to apex components June 24, 2009 Flavio Casetta - www.yocoya.com 6

June 24, 2009 Flavio Casetta - www.yocoya.com 7 mapping

tables, views, indexes June 24, 2009 Flavio Casetta - www.yocoya.com 8

tables, views, indexes oracle provides different types of tables tailored for different situations standard heap tables index organized tables aka IOTs cluster tables temporary tables external tables oracle EE allows table partitioning June 24, 2009 Flavio Casetta - www.yocoya.com 9

tables, views, indexes apex's table builder wizard creates only heap tables June 24, 2009 Flavio Casetta - www.yocoya.com 10

tables, views, indexes SQL Developer's table builder instead comes with advanced options June 24, 2009 Flavio Casetta - www.yocoya.com 11

tables, views, indexes heap tables are best for data that grows over time. The developer must properly design indexes for improving data access. when evaluating the indexes to be created, consider that any column(s) declared as foreign key(s) should be indexed in order to avoid contention if using oracle EE, consider using bitmap indexes for columns containing few distinct values on large tables with low transactional activity (like fact tables in a DW) June 24, 2009 Flavio Casetta - www.yocoya.com 12

tables, views, indexes IOTs are best for tables accessed by primary key and with low transactional activity. often reports and page items need to display a description starting from a foreign key value (which is the primary key of the IOT) unlike ordinary indexes, the primary key of an IOT cannot be rebuilt online June 24, 2009 Flavio Casetta - www.yocoya.com 13

tables, views, indexes cluster tables come in two forms: index clusters hash clusters clusters improve I/O by storing data together cluster tables pre-join tables index clusters require two logical reads hash clusters require one logical read hash clusters are best for very static data hash clusters need precise sizing information June 24, 2009 Flavio Casetta - www.yocoya.com 14

tables, views, indexes external tables are useful when importing data from texts file stored in a directory on the same database server if deploying an application on a multi-tenant hosting server, you might have no access to local folders finding the right format for an external table can be challenging. Certain combinations of parameters may introduce erratic behavior June 24, 2009 Flavio Casetta - www.yocoya.com 15

tables, views, indexes temporary tables are good for volatile data. There are two types of GTTs and they differ in scope: transaction (on commit delete rows) oracle session (on commit preserve rows) given the nature of apex architecture, usage of temporary tables is limited to operations that begin and end within the same transaction practical uses: reporting on data returned by a procedure June 24, 2009 Flavio Casetta - www.yocoya.com 16

tables, views, indexes views are meant to simplify the work of a developer by: hiding complex expressions or joins that would make a query difficult to deal with enforcing data access rules, i.e. to limit the results to data relevant to a certain user decoding values to human understandable language June 24, 2009 Flavio Casetta - www.yocoya.com 17

tables, views, indexes in apex, views are great for: reporting (user defined views) checking apex metadata (APEX_XXX) checking db dictionary (USER_XXX, ALL_XXX and a few V$ dynamic views) checking certain features like oracle text metadata and values (CTX_XXX views) June 24, 2009 Flavio Casetta - www.yocoya.com 18

performance June 24, 2009 Flavio Casetta - www.yocoya.com 19

performance tools for analyzing the performance of an apex page: monitor activity reports apex page debug mode explain plan trace files & TKPROF June 24, 2009 Flavio Casetta - www.yocoya.com 20

performance Monitor activity report Page Views by Weighted Page Performance Page Views by Application and Page June 24, 2009 Flavio Casetta - www.yocoya.com 21

performance page views by weighted page performance June 24, 2009 Flavio Casetta - www.yocoya.com 22

performance apex page debug mode: turn on debug by clicking on the debug link in the developer's toolbar of apex (restrictions apply) enter debug mode by adding YES as fifth parameter in the apex URL http://localhost:8080/apex/f?p=12345:1:0::yes in all cases debug mode must be enabled June 24, 2009 Flavio Casetta - www.yocoya.com 23

performance inspect debug output and spot elapsed time anomalies June 24, 2009 Flavio Casetta - www.yocoya.com 24

performance the most likely candidates for big delays in page rendering are non-optimized queries June 24, 2009 Flavio Casetta - www.yocoya.com 25

performance the next step is to check what's wrong with the query by using explain plan statistics must be up-to-date June 24, 2009 Flavio Casetta - www.yocoya.com 26

performance the full table scan indicates that we are missing an index as the query references three columns, the most effective index will contain those three columns the order of the columns in the index is important the analysys is carried out entirely using apex features June 24, 2009 Flavio Casetta - www.yocoya.com 27

performance After creating the index, the cost has decreased dramatically June 24, 2009 Flavio Casetta - www.yocoya.com 28

performance this is confirmed by the time elapsed recorded in the debug output June 24, 2009 Flavio Casetta - www.yocoya.com 29

performance additional considerations about the index: i created a compressed index, consuming fewer blocks the table is 100% static, so i set PCTFREE=0, saving even more blocks The difference in the number of blocks between the index created with default parameters and its extreme version is down 44% June 24, 2009 Flavio Casetta - www.yocoya.com 30

performance index options comparison June 24, 2009 Flavio Casetta - www.yocoya.com 31

performance example of query involving a single table hash cluster containing half million rows June 24, 2009 Flavio Casetta - www.yocoya.com 32

performance explain plan of the query on single table hash cluster June 24, 2009 Flavio Casetta - www.yocoya.com 33

performance what was the difference the day after? June 24, 2009 Flavio Casetta - www.yocoya.com 34

performance when the previously mentioned techniques are not enough, tracing can be enabled instrumenting the code in the right way can be a life safer if properly designed, code instrumentation can be enabled selectively, with minimal impact when it is not in use and without collecting unnecessary information June 24, 2009 Flavio Casetta - www.yocoya.com 35

performance enabling oracle tracing is easy: http://localhost:8080/apex/f?p=12345:1:0&p_trace=yes tracing makes sense only if you have access to folders on the database server (on a multi-tenant hosting service this type of action might have been restricted by the DBA) June 24, 2009 Flavio Casetta - www.yocoya.com 36

performance depending on apex's configuration (either using embedded PL/SQL gateway as Oracle XE or Apache HTTP server, trace files will be found in either in the background_dump_dest folder or in user_dump_dest for shared servers trace file name pattern is sid_snnn_pid.trc for dedicated sessions the trace file name pattern is sid_proc_pid_[tracefile_identifier].trc user_dump_dest and tracefile_identifier parameters don't apply for shared servers June 24, 2009 Flavio Casetta - www.yocoya.com 37

performance in order to spot the relevant SQL statements quickly, you can embed comments containing custom identifiers: select /* my_app LOV_EMP */ emp_name d, emp_id r from employees update order_items /* my_app my_page_num process xyz */ set qty = :P45_QTY where order_id = :P45_ORDER_ID June 24, 2009 Flavio Casetta - www.yocoya.com 38

PL/SQL and apex June 24, 2009 Flavio Casetta - www.yocoya.com 39

pl/sql apex make's possible to write an application without entering a single line of PL/SQL Functionalities that don't come off-the-shelf may require a little or a lot of custom PL/SQL The developer must be aware of pros and cons when adopting a method for executing PL/SQL June 24, 2009 Flavio Casetta - www.yocoya.com 40

pl/sql PL/SQL can be used in many places Processes & Computations Validations & conditions Post calculation, item source & initialization Report queries & report headings Dynamic LOVs PL/SQL regions Authentication functions & authorization schemes Shortcuts Supporting Objects June 24, 2009 Flavio Casetta - www.yocoya.com 41

pl/sql Given the potential ubiquity of PL/SQL inside apex components, the developer must choose how to handle this source code: as anonymous blocks as standalone procedures or functions as packaged procedures or functions June 24, 2009 Flavio Casetta - www.yocoya.com 42

pl/sql anonymous blocks are the most straightforward method to execute pl/sql more difficult to maintain or keep track of in case of an exception the source is exposed source code cannot be obfuscated editable only inside apex June 24, 2009 Flavio Casetta - www.yocoya.com 43

pl/sql standalone procedures or functions can be reasonable if their number is low source code can be obfuscated editable inside apex or with other sql clients potentially they are reusable potentially they can interfere with existing objects if installed in a preexisting schema version management is harder than with packages June 24, 2009 Flavio Casetta - www.yocoya.com 44

pl/sql packages are the way to go for large efforts source code can be obfuscated editable inside apex or with other sql clients packages are potentially reusable less prone to conflicts with existing objects if installed in a preexisting schema version management is easier than with standalone procedure and functions June 24, 2009 Flavio Casetta - www.yocoya.com 45

pl/sql reusable procedures and functions are the best candidates for inclusion in packages: logging procedures black list filtering general purpose utilities (the swiss-knife of each developer) page formatting utilities like HTF/HTP for different web languages June 24, 2009 Flavio Casetta - www.yocoya.com 46

snapshots or cached reports? June 24, 2009 Flavio Casetta - www.yocoya.com 47

snapshots or cache snapshots aka materialized views can save considerable resources they can be combined with cached report regions to achieve top performance snapshots come in handy when: you need to query a column resulting from a combination of multiple columns you need to quickly return aggregated results (sums, averages, etc.) June 24, 2009 Flavio Casetta - www.yocoya.com 48

snapshots or cache weighted page performance (4 wks) June 24, 2009 Flavio Casetta - www.yocoya.com 49

snapshots or cache weighted page performance (2 wks) June 24, 2009 Flavio Casetta - www.yocoya.com 50

snapshots or cache the significant difference was achieved by removing a cached region from page zero caching is not supported in page zero (a fact not mentioned in the manual or help, but mentioned in the output log in page debug mode ) without snapshots, upon expiration of the region cache, page rendering will incur in a significant increase of response time this occurrence can be eliminated by creating a snapshot updated in background June 24, 2009 Flavio Casetta - www.yocoya.com 51

synonyms and db links June 24, 2009 Flavio Casetta - www.yocoya.com 52

synonyms and db links the main reason for using synonyms is to make transparent to the application where the data come from a synonym can point to an object: in the same schema in another schema in a remote database (through a db-link) the type of target object can be decided during the installation for instance June 24, 2009 Flavio Casetta - www.yocoya.com 53

synonyms and db links developing an application basing on synonyms can be tricky apex does not list public synonyms in wizards it can be more productive to develop using local objects that are later replaced by corresponding synonyms typical situations are forms on tables, tabular forms and the query builder June 24, 2009 Flavio Casetta - www.yocoya.com 54

synonyms and db links another typical usage for public synonyms in apex is to make procedures callable by anonymous users from the URL creating a public synonym for RPC calls simplifies the URL syntax: www.acme.com/.../user.package.procedure?arg1=... www.acme.com/.../synonym?arg1=... for security reasons the synonym must also be registered in procedure wwv_flow_epg_include_mod_local June 24, 2009 Flavio Casetta - www.yocoya.com 55

Q&A session June 24, 2009 Flavio Casetta - www.yocoya.com 56