Agenda Database Development – Best Practices Why Performance Matters ?

Slides:



Advertisements
Similar presentations
AN INTRODUCTION TO PL/SQL Mehdi Azarmi 1. Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database.
Advertisements

Module 7 Designing Queries for Optimal Performance.
Clarity Educational Community Clarity Educational Community Creating and Tuning SQL Queries that Engage Users.
Database Software File Management Systems Database Management Systems.
Chapter 9 : Distributed Database.
LCT2506 Internet 2 Further SQL Stored Procedures.
A Guide to SQL, Seventh Edition. Objectives Embed SQL commands in PL/SQL programs Retrieve single rows using embedded SQL Update a table using embedded.
1 Tuning PL/SQL procedures using DBMS_PROFILER 20-August 2009 Tim Gorman Evergreen Database Technologies, Inc. Northern California Oracle.
Agenda Journalling More Embedded SQL. Journalling.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
Windows Azure Tour Benjamin Day Benjamin Day Consulting, Inc.
CSE 3330 Database Concepts Stored Procedures. How to create a user CREATE USER.. GRANT PRIVILEGE.
By: Matt Batalon, MCITP  Another form of temporary storage that can be queried or joined against, much like a table variable, temp.
Overview · What is PL/SQL · Advantages of PL/SQL · Basic Structure of a PL/SQL Block · Procedure · Function · Anonymous Block · Types of Block · Declaring.
What is a Package? A package is an Oracle object, which holds other objects within it. Objects commonly held within a package are procedures, functions,
PL/SQL programming Procedures and Cursors Lecture 1 [Part 2]
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
Said Salomon Unitrin Direct Insurance T-SQL Avoiding cursors Said Salomon.
Database Design: Solving Problems Before they Start! Ed Pollack Database Administrator CommerceHub.
Data Virtualization Demoette… Packaged Query Single Select Option
Cleveland SQL Saturday Catch-All or Sometimes Queries
A Guide to SQL, Seventh Edition
Query Optimization Techniques
Crash course on Better SQL Development
Stored Procedures.
SQL Server 2000 and Access 2000 limits
UNIT - V STORED PROCEDURE.
The Client/Server Database Environment
Splitting a Database: How and Why
Weird Stuff I Saw While ... Supporting a Java Team
Stored Procedure used in PosgreSQL
Software Architecture in Practice
PL/SQL Scripting in Oracle:
SQL Server May Let You Do It, But it Doesn’t Mean You Should
Purpose, Pitfalls and Performance Implications
Weird Stuff I Saw While ... Supporting a Java Team
Marcos Freccia Stop everything! Top T-SQL tricks to a developer
Client Access, Queries, Stored Procedures, JDBC
The Key to the Database Engine
Surviving parsing XML with T-SQL
Crash course on Better SQL Development
Save Time & Resources: Job Performance Tuning Strategies
Advanced PL/SQL Programing
G063 - Distributed Databases
Database.
Purpose, Pitfalls and Performance Implications
Stored Procedure used in PosgreSQL
Stored Procedure used in PosgreSQL
Top Tips for Better TSQL Stored Procedures
Stop Wasting Time & Resources: Performance Tune Your Jobs
TEMPDB – INTERNALS AND USAGE
Tally Ho! -- Explore the Varied Uses of Tally Tables
Crash course on Better SQL Development
Please thank our sponsors!
Stored Procedure used in PosgreSQL
When I Use NOLOCK AND OTHER HINTS
Crash course on Better SQL Development
In Memory OLTP Not Just for OLTP.
Unit I-2.
Oracle Memory Internals
Chapter 8 Advanced SQL.
MATERI PL/SQL Procedures Functions Packages Database Triggers
Crash course on Better SQL Development
Performance And Scalability In Oracle9i And SQL Server 2000
Database SQL.
New Technologies for Storage and Display of Meteorological Data
T-SQL Basics: Coding for performance
Processing Tabular Models
Efficient and Effective coding of stored procedures
Improving the Performance of Functions
Presentation transcript:

Agenda Database Development – Best Practices Why Performance Matters ? Day to Day Real-Time Examples Demos Questions?

Why Performance Matters? Poor Performance Frustrated Clients Annoyed Support Team Finally it comes to you

Database Development – Best Practices Reduce the Number of Calls Original Query

Database Development – Best Practices Reduce the Number of Calls Performance Improvement

Database Development – Best Practices Try to Avoid CAST/ CONVERT Original Query

Database Development – Best Practices Try to Avoid CAST/ CONVERT Performance Improvement

Database Development – Best Practices Use Dictionary Tables Original Query

Database Development – Best Practices Use Dictionary Tables Performance Improvement

Database Development – Best Practices Avoid using Sub -Queries or Nested Queries Original Query

Performance Improvement Database Development – Best Practices Avoid using Sub -Queries or Nested Queries Performance Improvement

Database Development – Best Practices Effective Utilization of CTE Original Query

Database Development – Best Practices Effective Utilization of CTE Performance Improvement

Database Development – Best Practices Remove Unnecessary/Unused Variables Original Query

Performance Improvement Database Development – Best Practices Remove Unnecessary/Unused Variables Performance Improvement

Database Development – Best Practices Better Readability Original Query Performance Improvement

Database Development – Best Practices Use Stored Procedures Maintainability Encapsulation Security Performance Reduce Server/Client Network Traffic Code Reusability Error Handling

Writing Comments in a Stored Procedure Database Development – Best Practices Writing Comments in a Stored Procedure One very helpful thing to do with your stored procedures is to add comments to your code.  This helps you to know what was done and why (for future reference) Also helps other DBAs or developers that may need to make modifications to the code.

Database Development – Best Practices Avoid Using Cursors Resources consumed by Cursors - occupies more resources (memory, IO, CPU) and temporary storage.  Performance Issues - Each time when a row is fetched from the cursor it may result in a network round trip. This uses much more network bandwidth. Repeated network round trips can degrade the speed of the operation using the cursor. How can you avoid Cursors? Using WHILE LOOPS Using temp tables Using User defined functions

ALWAYS CONSIDER PERFORMANCE Database Development – Best Practices Just because your SQL data set has few records currently it doesn’t mean that the data set won’t grow significantly after you move it to production. One common mistake is to run a poorly performing query in development when the system has no users querying and very few records. The query runs fast, because there’s no load on the database server. Then, when the query is promoted to production and run in a busy environment, the query performs poorly and undermines site performance. Always consider performance even if the query seems like it won’t need many resources from the database server. ALWAYS CONSIDER PERFORMANCE Even if the Query seems Simple