Unicode Oddity. from a Unicode PeopleSoft Database SELECT emplid, name, LENGTH(name), BLENGTH(name) FROMps_personal_data WHEREemplid = '007’ ; EMPLID.

Slides:



Advertisements
Similar presentations
POSTGRESQL DUNGEON WITH TABLE INHERITANCE AND CONSTRAINTS Edel Sherratt.
Advertisements

Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
An introduction to SQL*Trace, TKPROF and Execution Plans
1 Tuning with Oracle’s SQL Trace David Kurtz Go-Faster Consultancy Ltd.
Prligence Empowering Intelligence All About Fine Grained Access Control by Arup Nanda.
Row Migration can Aggravate Contention on Cache Buffer Chains Latch David Kurtz Go-Faster Consultancy Ltd.
Chapter 4B: More Advanced PL/SQL Programming
A Guide to SQL, Seventh Edition. Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT.
SQL DDL constraints Restrictions on the columns and tables 1SQL DDL Constraints.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
Module 5: Data Access. Overview Introduce database components involved in data access Introduce concepts of Transact -SQL and Procedural SQL as tools.
Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial Password: UWPstudent Password is case sensitive.
PL/SQL Bulk Collections in Oracle 9i and 10g Kent Crotty Burleson Consulting October 13, 2006.
MY SQL Eng: SAHAR. Introduction to SQL What is SQL? When a user wants to get some information from a database file, he can issue a query A query is a.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
SAGE Computing Services Customised Oracle Training Workshops and Consulting 11g New Features … of the SQL & PL/SQL Variety Scott Wesley Systems Consultant.
Solving Lab 3 Los Angeles Pierce College Computer Science 560.
Oracle Database Administration
Copyright © 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
SQL Data Definition Language (DDL) Using Microsoft SQL Server 1SDL Data Definition Language (DDL)
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
In Oracle.  A PL/SQL block stored in the database and fired in response to a specified event ◦ DML statements : insert, update, delete ◦ DDL statements.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
SQL: DDL. SQL Statements DDL - data definition language –Defining and modifying data structures (metadata): database, tables, views, etc. DML - data manipulation.
Using the Table API. Standard Uses of API Populate Columns via Sequences Insert Default Values instead of nulls Populate Autogen Columns –Date Created,
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
1 © 2010 Julian Dyke Edition-Based Redefinition Julian Dyke Independent Consultant juliandyke.com Web Version.
11-1 Copyright  Oracle Corporation, All rights reserved. What Are Constraints? Constraints enforce rules at the table level. Constraints prevent.
1 SQL - II Data Constraints –Applying data constraints Types of data constraints –I/O constraints The PRIMARY KEY constraints The FOREIGN KEY constraints.
Database Lab Lecture 1. Database Languages Data definition language ( DDL ) Data definition language –defines data types and the relationships among them.
# 1# 1 Creating Tables, Setting Constraints, and Datatypes What is a constraint and why do we use it? What is a datatype? What does CHAR mean? CS 105.
8 Copyright © 2007, Oracle. All rights reserved. Managing Schema Objects.
1 DBS201: More on SQL Lecture 3. 2 Agenda How to use SQL to update table definitions How to update data in a table How to join tables together.
Variables and control statements in PL\SQL Chapter 10.
SQL CREATING AND MANAGING TABLES lecture4 1. Database Objects ObjectDescription TableBasic unit of storage; composed of rows and columns ViewLogically.
Dynamic SQL. 2 home back first prev next last What Will I Learn? Recall the stages through which all SQL statements pass Describe the reasons for using.
13 Copyright © Oracle Corporation, All rights reserved. Maintaining Data Integrity.
Altering Tables and Constraints Database Systems Objectives Add and modify columns. Add, enable, disable, or remove constraints. Drop a table. Remove.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
PRACTICE OVERVIEW PL/SQL Part Your stored procedure, GET_BUDGET, has a logic problem and must be modified. The script that contains the procedure.
Optimization and Administartion of a Database Management Systems Krystian Zieja.
Basic SQL*Plus edit and execute commands SQL*Plus buffer and built-in editor holds the last SQL statement Statements are created in free-flow style and.
SQL constrains and keys. SORTED RESULTS Sort the results by a specified criterion SELECT columns FROM tables WHERE predicates ORDER BY column ASC/DESC;
Ch 3. Working with Tables and Views. Data type Specify type of data to be entered into a column (text, number, datetime, etc) Unicode (National) Datatypes.
Introduction to PL/SQL Francis Thottungal. The outline The basic PL/SQL code structure is : DECLARE -- optional, which declares and define variables,
Oracle9i Developer: PL/SQL Programming Chapter 11 Performance Tuning.
More about maintaining a table Use speaker notes for additional information!
A Guide to SQL, Sixth Edition 1 Chapter 5 Updating Data.
CSCI N311: Oracle Database Programming 5-1 Chapter 15: Changing Data: insert, update, delete Insert Rollback Commit Update Delete Insert Statement –Allows.
Cursor Sharing Bug: Bug : cursor_sharing=force causes ORA-7445 and core dumps related bugs – : production instance crashed with.
1 11g NEW FEATURES ByVIJAY. 2 AGENDA  RESULT CACHE  INVISIBLE INDEXES  READ ONLY TABLES  DDL WAIT OPTION  ADDING COLUMN TO A TABLE WITH DEFAULT VALUE.
8 Copyright © 2005, Oracle. All rights reserved. Managing Schema Objects.
MySQL Tutorial. Databases A database is a container that groups together a series of tables within a single structure Each database can contain 1 or more.
Creating and Managing Tables. Database Objects ObjectDescription TableBasic unit of storage; composed of rows and columns ViewLogically represents subsets.
2 Copyright © 2009, Oracle. All rights reserved. Managing Schema Objects.
CS SQL.
CS 3630 Database Design and Implementation
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
Lecturer: Mukhtar Mohamed Ali “Hakaale”
Workbench Data Definition Language (DDL)
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
Lesson Plan Instructional Objective Learning Objective
Data Definition Language
Dynamic SQL Example declare l_depnam varchar2(20) := 'testing'; l_loc varchar2(10) := 'Dubai'; begin execute immediate 'insert into dept values (:1,:2,:3)'
Triggers.
SQL NOT NULL Constraint
SQL (Structured Query Language)
Presentation transcript:

Unicode Oddity

from a Unicode PeopleSoft Database SELECT emplid, name, LENGTH(name), BLENGTH(name) FROMps_personal_data WHEREemplid = '007’ ; EMPLID NAME LENGTH(NAME) BLENGTH(NAME) Cona¿ová,d 10 12

Insert 10 characters in 11 bytes CREATE TABLE fred (fred10 VARCHAR2(11)); Table created. INSERT INTO fred SELECT name FROM ps_personal_data WHERE emplid = '007'; ERROR at line 1: ORA-01401: inserted value too large for column

Insert 10 characters in 12 bytes CREATE TABLE fred (fred10 VARCHAR2(12)); Table created. INSERT INTO fred SELECT name FROM ps_personal_data WHERE emplid = '007'; 1 row created.

How does PeopleSoft create tables? CREATE TABLE fred (fred10 VARCHAR2(30) CHECK (LENGTH(fred10)<=10) ); Table created.

So... Length checking constraint on EVERY character column in the database! >500,000 user constraints What effect does this have on performance

Experiment 1 create table test_nocons (id number,field_01 varchar2(30) …,field_20 varchar2(30) ); create table test_cons (id number,field_01 varchar2(30) CHECK(LENGTH(field_01)<=30 ) …,field_20 varchar2(30) CHECK(LENGTH(field_01)<=30 ) );

Populate tables, trace enabled alter session set sql_trace = true; BEGIN FOR i IN LOOP INSERT INTO test_nocons VALUES (i,RPAD(TO_CHAR(i),11,'.') …,RPAD(TO_CHAR(i),30,'.') ); COMMIT; END LOOP; END; /

Results of Experiment 1 Insert rows CPU time for recursive SQL on my 500Mhz Laptop –No constraints: 11.08s –With constraints13.23s

Experiment 2 Now deliberately generate different SQL statements, forcing parse every time. BEGIN FOR i IN LOOP EXECUTE IMMEDIATE 'INSERT INTO test_nocons VALUES ('||i||',RPAD(TO_CHAR('||i||'),11,''.''))'; END LOOP; COMMIT; END; /

Results of Experiment 2 >99% parse time Duration of parse CPU –Without Constraints: 41.05s –With Constraints: s

Conclusion Execution of constraints adds overhead. –On my PC 15%-20% increase in CPU consumption. If you have much SQL parsing this will aggravate the problem. In my case 4 times worse.

Unicode Oddity David Kurtz Go-Faster Consultancy Ltd.