Birth, Death, Infinity Gus Björklund. ???. Dan Foreman. BravePoint. PUG Challenge Dusseldorf 2014.

Slides:



Advertisements
Similar presentations
Progress System Tables
Advertisements

The Architecture of Oracle
DB-7: OpenEdge® Database Performance Tuning
DB-03: A Tour of the OpenEdge™ RDBMS Storage Architecture Richard Banville Technical Fellow.
CS4432: Database Systems II Buffer Manager 1. 2 Covered in week 1.
Strength. Strategy. Stability. The Application Profiler.
Some More Database Performance Knobs North American PUG Challenge
T OP N P ERFORMANCE T IPS Adam Backman Partner, White Star Software.
Buffer Cache Waits. #.2 Copyright 2006 Kyle Hailey Buffer Cache Waits Waits Disk I/O Buffer Busy Library Cache Enqueue SQL*Net Free Buffer Hot Blocks.
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Oracle Architecture. Instances and Databases (1/2)
File Systems Examples.
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
Harvard University Oracle Database Administration Session 5 Data Storage.
Chapter 15.7 Buffer Management ID: 219 Name: Qun Yu Class: CS Spring 2009 Instructor: Dr. T.Y.Lin.
Backup and Recovery Part 1.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
DB Audit Expert v1.1 for Oracle Copyright © SoftTree Technologies, Inc. This presentation is for DB Audit Expert for Oracle version 1.1 which.
New Generation of OpenEdge ® RDBMS Advanced Storage Architecture II Tomáš Kučera Principal Solution Engineer / EMEA Power Team.
MOVE-4: Upgrading Your Database to OpenEdge® 10 Gus Björklund Wizard, Vice President Technology.
1 PUG Challenge Americas 2015 Click to edit Master title style PUG Challenge USA 2015 Top Performance Enhancers & Destroyers Presented by: Dan Foreman.
Backup & Recovery 1.
Administration etc.. What is this ? This section is devoted to those bits that I could not find another home for… Again these may be useless, but humour.
Birth, Death, Infinity Gus Björklund. Progress. Dan Foreman. BravePoint. PUG Challenge Americas, 9-12 June 2013.
Real-Time Concepts for Embedded Systems Author: Qing Li with Caroline Yao ISBN: CMPBooks.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Top Performance Enhancers Top Performance Killers in Progress Dan Foreman Progress Expert
Basic Oracle Architecture
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
CSE 781 – DATABASE MANAGEMENT SYSTEMS Introduction To Oracle 10g Rajika Tandon.
70-294: MCSE Guide to Microsoft Windows Server 2003 Active Directory, Enhanced Chapter 4: Active Directory Architecture.
Strength. Strategy. Stability.. Progress Performance Monitoring and Tuning Dan Foreman Progress Expert BravePoint BravePoint
A first look at table partitioning PUG Challenge Americas Richard Banville & Havard Danielsen OpenEdge Development June 9, 2014.
Architecture Rajesh. Components of Database Engine.
Database Systems Slide 1 Database Systems Lecture 5 Overview of Oracle Database Architecture - Concept Manual : Chapters 1,8 Lecturer : Dr Bela Stantic.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
Copyright © Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
Chapter 4. INTERNAL REPRESENTATION OF FILES
Introduction to the new mainframe © Copyright IBM Corp., All rights reserved. Chapter 12 Understanding database managers on z/OS.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
Recovery Log Notes Gus Björklund, Progress Dan Foreman, Bravepoint 2014 Americas PUG Challenge Westford, MA June 8 – June
1 Logical I/O Julian Dyke Independent Consultant Web Version juliandyke.com © 2005 Julian Dyke.
INTRODUCTION TO ORACLE DATABASE ADMINISTRATION Lynnwood Brown President System Managers LLC Introduction – Lecture 1 Copyright System Managers LLC 2003.
DB-08: A Day in the Life of a Type II Record Richard Banville Progress Fellow.
Connect with life Vinod Kumar Technology Evangelist - Microsoft
Academic Year 2014 Spring. MODULE CC3005NI: Advanced Database Systems “DATABASE RECOVERY” (PART – 2) Academic Year 2014 Spring.
Backup and Recovery - II - Checkpoint - Transaction log – active portion - Database Recovery.
CS4432: Database Systems II
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2007.
Retele de senzori Curs 2 - 1st edition UNIVERSITATEA „ TRANSILVANIA ” DIN BRAŞOV FACULTATEA DE INGINERIE ELECTRICĂ ŞI ŞTIINŢA CALCULATOARELOR.
Bigtable A Distributed Storage System for Structured Data.
Oracle Database Architectural Components
1 Copyright © 2005, Oracle. All rights reserved. Oracle Database Administration: Overview.
Database Applications (15-415) DBMS Internals- Part III Lecture 13, March 06, 2016 Mohammad Hammoud.
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.
Introduction to OpenEdge Change Data Capture
Module 11: File Structure
Database structure and space Management
Behind The Scenes: Updating A Record
Database Management Systems (CS 564)
Lecture 10: Buffer Manager and File Organization
Database Applications (15-415) DBMS Internals- Part III Lecture 15, March 11, 2018 Mohammad Hammoud.
Database Internals: How Indexes Work
Transaction Log Internals and Performance David M Maxwell
Presentation transcript:

Birth, Death, Infinity Gus Björklund. ???. Dan Foreman. BravePoint. PUG Challenge Dusseldorf 2014

© 2014 Progress Software Corporation. All rights reserved. 2 Birth, Death, Infinity abstract In this talk we follow the life of a database record from its initial conception, creation, reading, & updates, to eventual deletion. The discussion will include the environment that record CRUD activities take place in and the different resources that are impacted: disk, memory, latches, semaphores, record locks, blocks, etc. We will also touch on the aspects of a record's life that directly and indirectly impact performance. This may sound like a mega-geek presentation, and it is, however there are many practical aspects to this information that have a direct impact on DBAs as well as developers.

© 2014 Progress Software Corporation. All rights reserved. 3 Birth, Death, Infinity Dan Foreman – C.V.  Progress User since 1984 – my 30 year anniversary  V2.1 (there was not a commercial V1)  Author of several Progress Publications Progress Performance Tuning Guide Progress Database Administration Guide Progress System Tables  Basketball & Bicycle Fanatic…which sometimes leads to unexpected trips to the Emergency Room Warning – potentially disturbing content

© 2014 Progress Software Corporation. All rights reserved. 4 Birth, Death, Infinity

© 2014 Progress Software Corporation. All rights reserved. 5 Birth, Death, Infinity Dan Foreman – C.V. My New Wheels (so I won’t fall over again)

© 2014 Progress Software Corporation. All rights reserved. 6 Birth, Death, Infinity Audience Intro  Longest Progress User?  Progress version? V6 V7 V8 V9 V10 V11

© 2014 Progress Software Corporation. All rights reserved. 8 Birth, Death, Infinity Conception

© 2014 Progress Software Corporation. All rights reserved. 9 Birth, Death, Infinity A Table is defined  Use the Data Dictionary Tool Type in all the information  Load a “.df" file run prodict/load_df.p (os-getenv ("SCHEMADIR") + "/" "customer.df").  Execute a SQL DDL statement CREATE TABLE pub.customer (cust-num integer,... ) AREA "a51"; Methods for defining a new table:

Where does the definition go?

© 2014 Progress Software Corporation. All rights reserved. 11 Birth, Death, Infinity Table definitions _file _field One _field record (row) for each field (column) of a table The _* tables live in the Schema Area. Put yours elsewhere.

© 2014 Progress Software Corporation. All rights reserved. 12 Birth, Death, Infinity List Your Tables and Their Fields output to tables.txt. for each _file where (0 < _file-num): put _file-name skip. for each _field of _file: put “ “ _field-name skip. end. put “” skip. end. output close.

© 2014 Progress Software Corporation. All rights reserved. 13 Birth, Death, Infinity Index definitions _file _index _index-field One _index record for each index of a table One _index-field record for each key component of an index _index

© 2014 Progress Software Corporation. All rights reserved. 14 Birth, Death, Infinity List indexes and key components by table output to index.txt. for each _file where (0 < _file-num): put _file-name skip. for each _index of _file: put " " _index-name skip. for each _index-field of _index: find _field where recid (_field) = _field-recid. put " " _field-name skip. end. put "" skip. end. output close.

Where do the Initial values go?

© 2014 Progress Software Corporation. All rights reserved. 16 Birth, Death, Infinity The template record  Each table has a template record  Column values in the template become the Initial values for new records  Template records are NOT stored with schema metadata Go in table's home area or schema area (V11) Have to read from database to get template  TODAY and NOW defaults replaced with current values from the system clock

© 2014 Progress Software Corporation. All rights reserved. 17 Birth, Death, Infinity Birth

© 2014 Progress Software Corporation. All rights reserved. 18 Birth, Death, Infinity CREATE a new row in a 4GL program create customer.

© 2014 Progress Software Corporation. All rights reserved. 19 Birth, Death, Infinity CREATE a new row in a 4GL program create customer. what happens? we read template record from database (if we don't have it already) client (local) buffer is populated with a copy of the template record current values inserted for TODAY, NOW no write to database – db knows nothing about the create at this point.

© 2014 Progress Software Corporation. All rights reserved. 20 Birth, Death, Infinity Where does customer row go? CONDB customer order Etc. DBDES CI for customer FDTBL for database foo ICB for table customer row buffer

© 2014 Progress Software Corporation. All rights reserved. 21 Birth, Death, Infinity assign column values Address Address2 City Contact Curr-bal Cust-num Discount Max-credit Mnth-sales Name Phone Sales-region Sales-rep St Tax-no Terms Ytd-sls Zip

when do we send it to the database ?

© 2014 Progress Software Corporation. All rights reserved. 23 Birth, Death, Infinity database accelerator

© 2014 Progress Software Corporation. All rights reserved. 24 Birth, Death, Infinity Some basic rules for when a record is written  VALIDATE statement  RELEASE statement  Buffer goes out of scope  All fields for a unique key are ASSIGNed a value  A LOB field is populated  RECID function  ROWID function  Other stuff

© 2014 Progress Software Corporation. All rights reserved. 25 Birth, Death, Infinity Remote client sends row to database client's row buffer server's network message buffer server's row buffer client's network message buffer TCP/IP

where do we put it ?

© 2014 Progress Software Corporation. All rights reserved. 27 Birth, Death, Infinity Database Pages (Blocks)  Database divided into fixed-size blocks or “pages”  Adjacent blocks form clusters in Type 2 Areas  Different kinds of blocks store different kinds of data  Disk i/o done in block size units  Each block has unique identifier – its “dbkey”  Data blocks are called RM (Record Manager) blocks  Index blocks are called IX blocks

© 2014 Progress Software Corporation. All rights reserved. 28 Birth, Death, Infinity Search-for-RM-Space Hierarchy 1.Is there space on the RM Chain Per Object in Type 2 Per Area in Type 1 2.Is there space on the Free Chain 3.Are there Empty Blocks above the Area HWM 4.Extend the DB Format the block Move the HWM Update various counters & chains  See these slides for space allocation algorithm details  Space, the final frontier

© 2014 Progress Software Corporation. All rights reserved. 29 Birth, Death, Infinity Find data block, read into database buffer pool Hash Table LRU Chain “oldest (LRU)” “newest (MRU)” Page Writer Queue MMM MM MMMM Checkpoint Queue

© 2014 Progress Software Corporation. All rights reserved. 30 Birth, Death, Infinity Update data block  Acquire exclusive lock on buffer  Generate "create" BI note  Spool bi note  Copy from row buffer to data block  Update block free space if needed  Mark buffer as modified  Create index keys for all active indexes (details later)  Release buffer locks  More stuff that happens that we don’t have time for: Trigger firing (some info in the Recovery Notes session) Sequences (“”) VST & promon counters updated note: simplified. some details omitted to protect the innocent

© 2014 Progress Software Corporation. All rights reserved. 31 Birth, Death, Infinity Record In A Row Data Block (aka RM Block) block header RM block header dir entry 0 free space record 0 Newly created row is stored in some row data block and assigned an available directory entry. The chosen block and directory entry determine the ROWID record 1 record 2 record 3 dir entry 1 dir entry 2 dir entry 3

© 2014 Progress Software Corporation. All rights reserved. 32 Birth, Death, Infinity Birth Alternatives

© 2014 Progress Software Corporation. All rights reserved. 33 Birth, Death, Infinity Other ways records are born  sql: INSERT INTO customer (cust-no, name street, city, state) VALUES (642, 'gus', '14 oak park', 'bedford', 'ma');  sql: INSERT INTO customer (cust-no, name street, city, state) SELECT... FROM... WHERE... ;  binary load: proutil foo -C load bar.bd

© 2014 Progress Software Corporation. All rights reserved. 34 Birth, Death, Infinity Possible Problems

© 2014 Progress Software Corporation. All rights reserved. 35 Birth, Death, Infinity Things to consider  When record is sent to database before all the values are assigned, one database operation create  becomes several create update etc.  The record expands as more values are assigned fragmentation will occur  Attend the Recovery Notes presentation for some excellent examples

© 2014 Progress Software Corporation. All rights reserved. 36 Birth, Death, Infinity Life

© 2014 Progress Software Corporation. All rights reserved. 37 Birth, Death, Infinity READ find customer where custnum = 3447.

© 2014 Progress Software Corporation. All rights reserved. 38 Birth, Death, Infinity READ  Compiler determines which index to use (perhaps custnum) R-code has index information Query used to form equality or range bracket  At runtime, load schema cache into client’s memory  Look up the table number (# 3)  Find _storage-object records for table #3 (for tenant #t) to get Area#  Look up the index number (# 113)  Find _storage-object records for index #113 (for tenant #t) to get Area#  Load into “OM cache” so we can use again (set -omsize)  Get location of the index root block from _storage-object  Traverse index B-tree to leaf, perhaps custnum = 3447  Get row's rowid 9006 from index leaf block  Get share lock on row 9006  Read data block(s) containing row fragments  Copy row fragments to 4GL buffer (SELF) or network buffer (REMC)

© 2014 Progress Software Corporation. All rights reserved. 39 Birth, Death, Infinity Find row in database Block’s DBKEYTypeChainBackup Ctr Next DBKEY in ChainBlock Update Counter Free Space Free Dirs. Rec 0 OffsetRec 1 Offset Rec 2 OffsetRec n Offset Num Dirs. Free Space Used Data Space Record 0 Record 2 Record 1 server’s row buffer Share locked RM block in buffer pool client’s network message buffer client's row buffer server’s network message buffer TCP/IP

© 2014 Progress Software Corporation. All rights reserved. 40 Birth, Death, Infinity row buffer connected CONDB customer order Etc. DBDES CI for customer FDTBL for database foo ICB for table customer row buffer (cust 3447)

© 2014 Progress Software Corporation. All rights reserved. 41 Birth, Death, Infinity UPDATES do transaction: find customer where cust-num = 3447 exclusive-lock: customer.city = "Westford". end. end.

© 2014 Progress Software Corporation. All rights reserved. 42 Birth, Death, Infinity Assign new value to city “Westford” 4GL runtime stack row buffer (cust 3447) Boston ICB for table customer CI for customer field n

© 2014 Progress Software Corporation. All rights reserved. 43 Birth, Death, Infinity Assign new value to city “Westford” 4GL runtime stack row buffer Westford ICB for table customer CI for customer field n

when do we send it to the database ?

© 2014 Progress Software Corporation. All rights reserved. 45 Birth, Death, Infinity Remote client sends row to database client's row buffer server's network message buffer server's row buffer client's network message buffer TCP/IP

© 2014 Progress Software Corporation. All rights reserved. 46 Birth, Death, Infinity Update data block  Acquire exclusive lock on block buffer  Read data block into buffer pool  Generate "record difference" bi note  Spool bi note  Modify data block  Update free space  Mark block modified  Release buffer lock

© 2014 Progress Software Corporation. All rights reserved. 47 Birth, Death, Infinity Update other data blocks  Indexes have to be updated too (city is a key field)  Delete existing index entry for "Boston"  Insert new index entry for "Westford“  Other stuff B-Tree might need to be rebalanced The addition of the new key might cause a block split

© 2014 Progress Software Corporation. All rights reserved. 48 Birth, Death, Infinity Fragment chain block header RM block header dir entry 0 free space record 0 record 1 record 2 record 3 (part 1 of row) dir entry 1 dir entry 2 dir entry 3 block header RM block header dir entry 0 free space record 0 record 1 (part 2 of row) dir entry 1

© 2014 Progress Software Corporation. All rights reserved. 49 Birth, Death, Infinity Death

© 2014 Progress Software Corporation. All rights reserved. 50 Birth, Death, Infinity Deleting do transaction: for each customer where city = "Boston“ : delete customer. end. end.

© 2014 Progress Software Corporation. All rights reserved. 51 Birth, Death, Infinity Deleting (sql) delete from customer where city = "Boston";

© 2014 Progress Software Corporation. All rights reserved. 52 Birth, Death, Infinity Update data block  Acquire exclusive lock on block buffer  Read data block into buffer pool  Generate "record delete" bi note  Spool bi note  Modify data block  Update free space  Rearrange the records in the block if necessary to keep free space contiguous  Mark block as modified  Do approximately the same things for all indexes on the table (next)  Release buffer locks

© 2014 Progress Software Corporation. All rights reserved. 53 Birth, Death, Infinity Update other data blocks  Indexes have to be updated too  After each record delete Delete existing index entry for "Boston" Delete all the other index entries too  For unique index entries, replace with a reservation (placeholder) The key value cannot be used until deleting transaction commits  Deletes for Word Indexes….one operation per word/key

© 2014 Progress Software Corporation. All rights reserved. 54 Birth, Death, Infinity deleted ROWID Reservation block header RM block header dir entry 0 free space record 0 record 1 record 2 dir entry 1 dir entry 2 dir entry 3 ROWID cannot be recycled until after the deleting transaction commits. Why ?

© 2014 Progress Software Corporation. All rights reserved. 55 Birth, Death, Infinity deleted ROWID Reservation block header RM block header dir entry 0 free space record 0 record 1 record 2 dir entry 1 dir entry 2 dir entry 3 ROWID cannot be recycled until after the deleting transaction commits. Why ? What ELSE can go wrong during UNDO ?

What could go wrong ?

© 2014 Progress Software Corporation. All rights reserved. 57 Birth, Death, Infinity deleted ROWID Reservation block header RM block header dir entry 0 free space record 0 record 1 record 2 dir entry 1 dir entry 2 dir entry 3 ROWID cannot be recycled until after the deleting transaction commits. Why ? What ELSE can go wrong during UNDO ?

© 2014 Progress Software Corporation. All rights reserved. 58 Birth, Death, Infinity deleted ROWID Reservation block header RM block header dir entry 0 free space record 0 record 1 record 2 dir entry 1 dir entry 2 dir entry 3 ROWID cannot be recycled until after the deleting transaction commits. Why ? What can go wrong during UNDO ? Not enough space. another transaction has taken it.

Infinity

How can a row live after death ?

© 2014 Progress Software Corporation. All rights reserved. 61 Birth, Death, Infinity Life after death  Your records live on forever in: Backup archives Archived after-image extents Audit data Archived audit data Binary dump files Reports Dropbox etc.  If you have any of these, where? Can you find a specific record?  Is the data encrypted? Where are the keys ?  Can we subpoena your records ? We may.

© 2014 Progress Software Corporation. All rights reserved. 62 Birth, Death, Infinity That’s all we have time for today, except

© 2014 Progress Software Corporation. All rights reserved. 63 Birth, Death, Infinity Thank You!  Спасибо  Danke  dank u  Aitäh  Ačiū  Kiitos  ありがとう

© 2014 Progress Software Corporation. All rights reserved. 64 Birth, Death, Infinity Answers