Query Optimization By Rick Mason, SeedChoices.com.

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizards Guide to PHP by David Lash.
Advertisements

Copyright © SoftTree Technologies, Inc. DB Tuning Expert.
AN INTRODUCTION TO PL/SQL Mehdi Azarmi 1. Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database.
Chapter 9: Advanced SQL and PL/SQL Topics Guide to Oracle 10g.
A Comparison of Database Software CS 616 April 8, 2004 Team 7 Mandar Patankar Jonathan Cohen B. Timothy Walsh.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Copying, Managing, and Transforming Data With DTS.
Introduction to PL/SQL Chapter 9. Objectives Explain the need for PL/SQL Explain the benefits of PL/SQL Identify the different types of PL/SQL blocks.
Module 2: Using Transact-SQL Querying Tools. Overview SQL Query Analyzer Using the Object Browser Tool in SQL Query Analyzer Using Templates in SQL Query.
Overview What is SQL Server? Creating databases Administration Security Backup.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 13 Managing Databases with SQL Server 2000.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Chapter 7 PHP Interacts with Ms. Access (Open DataBase Connectivity (ODBC))
IMS 4212: Application Architecture and Intro to Stored Procedures 1 Dr. Lawrence West, Management Dept., University of Central Florida
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
Stored Procedures (dynamic Order By + Web Assistant Wizard) Kevin Penny, MMCP
Dexterity | CONFIDENTIAL 2009 MRO | Analytics | Insights 1 Stored Procedures.
Stored Procedures, Triggers, Program Access Dr Lisa Ball 2008.
Module 11: Programming Across Multiple Servers. Overview Introducing Distributed Queries Setting Up a Linked Server Environment Working with Linked Servers.
Chapter 2: SQL – The Basics Objectives: 1.The SQL execution environment 2.SELECT statement 3.SQL Developer & SQL*Plus.
SQL Server Indexes Indexes. Overview Indexes are used to help speed search results in a database. A careful use of indexes can greatly improve search.
Copyright © Curt Hill Stored Procedures In Transact-SQL.
Triggers and Stored Procedures in DB 1. Objectives Learn what triggers and stored procedures are Learn the benefits of using them Learn how DB2 implements.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
CERN - IT Department CH-1211 Genève 23 Switzerland t DB Development Tools Benthic SQL Developer Application Express WLCG Service Reliability.
Improving Database Performance Derrick Rapley
By Shanna Epstein IS 257 September 16, Cnet.com Provides information, tools, and advice to help customers decide what to buy and how to get the.
3 3 Chapter 3 Structured Query Language (SQL) Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Commercial RDBMSs Access and Oracle. Access DBMS Architchecture  Can be used as a standalone system on a single PC: -JET Engine -Microsoft Data Engine.
T-SQL: Simple Changes That Go a Long Way DAVE ingeniousSQL.com linkedin.com/in/ingenioussql.
Visual Programing SQL Overview Section 1.
Indexes and Views Unit 7.
Chapter 9: Advanced SQL and PL/SQL Guide to Oracle 10g.
PowerBuilder Online Courses - by Prasad Bodepudi Database Painter Primary & Foreign Keys Extended Attributes PowerBuilder System Tables Database Profiles.
CF and Stored Procedures Lei Wang ALP International.
Slide 1 of 19Session 13 Ver. 1.0 Querying and Managing Data Using SQL Server 2005 In this session, you will learn to: Implement stored procedures Implement.
Foundations of Business Intelligence: Databases and Information Management.
SQL/Lesson 7/Slide 1 of 32 Implementing Indexes Objectives In this lesson, you will learn to: * Create a clustered index * Create a nonclustered index.
Session 1 Module 1: Introduction to Data Integrity
Learningcomputer.com SQL Server 2008 –Views, Functions and Stored Procedures.
Stored Procedure Optimization Preventing SP Time Out Delay Deadlocking More DiskReads By: Nix.
Creating Indexes on Tables An index provides quick access to data in a table, based on the values in specified columns. A table can have more than one.
Performance. Performance Performance is a critical issue especially in a multi-user environment. Benchmarking is one way of testing this.
Stored Procedures / Session 4/ 1 of 41 Session 4 Module 7: Introducing stored procedures Module 8: More about stored procedures.
IMS 4212: Application Architecture and Intro to Stored Procedures 1 Dr. Lawrence West, Management Dept., University of Central Florida
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
Table Structures and Indexing. The concept of indexing If you were asked to search for the name “Adam Wilbert” in a phonebook, you would go directly to.
Advanced SQL: Cursors & Stored Procedures Instructor: Mohamed Eltabakh 1.
Access 2, FORM BASICS In Access. 9/22/042 Access Lab Plan To Develop a Database & Applications To Learn Class Concepts To Learn Access Basics.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
SQL Triggers, Functions & Stored Procedures Programming Operations.
 What is DB Testing ?  Testing at the Data Access Layer  Need for Testing DB Objects  Common Problems that affect the Application  Should Testers.
Dynamic SQL Writing Efficient Queries on the Fly ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
Presentation Title Goes Here …presentation subtitle. SCRIPTS FOR RETRIEVING DATASETS.
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
Stored Procedures.
Web Technologies IT230 Dr Mohamed Habib.
Chapter Name By Adrienne Watt
PRACTICE OVERVIEW PL/SQL Part - 2.
The PROCESS of Queries John Deardurff
The PROCESS of Queries John Deardurff Website: ThatAwesomeTrainer.com
The PROCESS of Queries John Deardurff
MATERI PL/SQL Procedures Functions Packages Database Triggers
Chapter 11 Managing Databases with SQL Server 2000
Oracle Stored Procedures and Functions
Presentation transcript:

Query Optimization By Rick Mason, SeedChoices.com

Just because you can do something in ColdFusion Doesn’t always mean ColdFusion is the best way to do it

Always have the database do as much of the work as possible - Ben Forta

First step : Create Indexes Greatest performance boost with the least effort MS Access automatically indexes primary keys and foreign keys SQL Server doesn’t – you must do it yourself

SQL Server indexes Clustered Non-Clustered

Clustered Indexes Mostly for tables primary key Only one clustered index per table Orders tables data in order you specify

Non-Clustered Indexes You can have multiple non-clustered indexes An important tool in query optimization All non-clustered indexes go through tables clustered index if one is available

Using SQL Server query analyzer

Second step: Stored procedures What is a stored procedure? Pre-compiled SQL statement residing in the database You can pass parameters in You can receive result sets(s) out

Why use stored procedures? Pre-compile once, use many times Stored procedure is a re-usable object Reduce network traffic Separate business rules and logic from presentation layer They’re faster

Writing stored procedures Create procedure[name] Input parameters Output parameters AS Declare local variables SQL statement

Stored procedure example

Calling stored procedures – Using CFQuery {CALL USP_CompanyProductList('#CompanyDistrictID#')}

Calling Stored Procedures - Using cfstoredproc <cfstoredproc procedure=“DealInv” Datasource=“MyData”> <cfprocparam type=“IN” Cfsql type = “CF_SQL_Integer” Value=‘#CompanyDistrictID#’>

You need to use cfstoredproc If you need more than one result set You’re using Oracle or DB2

Running a stored procedure CFQuery or CFStoredProc goes here Your query produced an error #Catch.Detail#

Stored procedure – Insert example Create Procedure varchar(20) AS INSERT Into Person(PersonUserName, Select AS PersonID

What about MS Access? CFStoredProc can call stored Access queries and pass variables CFQUERY CALL will run queries but not let you pass variables Make sure cfadministrator has execute remote procedures turned on for your data source

Calling a stored procedure in Access

Automating Stored Procedure Creation With the Stored Procedure Wizard ftp://ftp.productivityenhancement.com/storedprocwiz10.zip By the folks at ColdFusionTraining.com

Additional references Using Stored Procedures by Ian Rutherford in CF Dev. Journal – Oct, Dec 2001 & Feb, May 2002 Stored Procedures in Access by Charlie Arehart in CF Dev. Journal – Oct 1999 MS SQL Server 7 Administrators Guide by Ron Talmage – ISBN

Contact