Top-level DB design for Big Data in ATLAS Experiment at CERN

Similar documents
An SQL-based approach to physics analysis

Using the In-Memory Columnar Store to Perform Real-Time Analysis of CERN Data. Maaike Limper Emil Pilecki Manuel Martín Márquez

Course Contents of ORACLE 9i

CERN s Business Computing

ATLAS Oracle database applications and plans for use of the Oracle 11g enhancements

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

The ATLAS EventIndex: Full chain deployment and first operation

The ATLAS EventIndex: an event catalogue for experiments collecting large amounts of data

Using Oracle STATSPACK to assist with Application Performance Tuning

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

COOL performance optimization using Oracle hints

Overview. About CERN 2 / 11

Oracle Hyperion Profitability and Cost Management

1-2 Copyright Ó Oracle Corporation, All rights reserved.

Storage and I/O requirements of the LHC experiments

CERN openlab II. CERN openlab and. Sverre Jarp CERN openlab CTO 16 September 2008

Conference The Data Challenges of the LHC. Reda Tafirout, TRIUMF

Oracle database overview. OpenLab Student lecture 13 July 2006 Eric Grancher

Data Warehousing & Big Data at OpenWorld for your smartphone

Oracle Performance Tuning. Overview of performance tuning strategies

VLDB. Partitioning Compression

Informatica Data Explorer Performance Tuning

Table Compression in Oracle9i Release2. An Oracle White Paper May 2002

Automating Information Lifecycle Management with

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

Voldemort. Smruti R. Sarangi. Department of Computer Science Indian Institute of Technology New Delhi, India. Overview Design Evaluation

CSCS CERN videoconference CFD applications

Scientific data processing at global scale The LHC Computing Grid. fabio hernandez

Grid Computing a new tool for science

The CMS data quality monitoring software: experience and future prospects

THE ATLAS DISTRIBUTED DATA MANAGEMENT SYSTEM & DATABASES

C Examcollection.Premium.Exam.58q

Oracle Optimizer: What s New in Oracle Database 12c? Maria Colgan Master Product Manager

Tablespace Usage By Schema In Oracle 11g Query To Check Temp

How to discover the Higgs Boson in an Oracle database. Maaike Limper

IEPSAS-Kosice: experiences in running LCG site

Worldwide Production Distributed Data Management at the LHC. Brian Bockelman MSST 2010, 4 May 2010

SQL Coding Guidelines

CERN and Scientific Computing

The CMS Computing Model

Oracle 11g Partitioning new features and ILM

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

Managing Performance Through Versioning of Statistics

ATLAS NOTE. December 4, ATLAS offline reconstruction timing improvements for run-2. The ATLAS Collaboration. Abstract

Fast, In-Memory Analytics on PPDM. Calgary 2016

ATLAS Data Management Accounting with Hadoop Pig and HBase

Microsoft. [MS20762]: Developing SQL Databases

CouchDB-based system for data management in a Grid environment Implementation and Experience

Oracle Platform Performance Baseline Oracle 12c on Hitachi VSP G1000. Benchmark Report December 2014

The GAP project: GPU applications for High Level Trigger and Medical Imaging

Preparing for High-Luminosity LHC. Bob Jones CERN Bob.Jones <at> cern.ch

How To Reduce Temp Tablespace Size In Oracle 11g

Evaluation of the computing resources required for a Nordic research exploitation of the LHC

Batch Services at CERN: Status and Future Evolution

Oracle Data Warehousing Pushing the Limits. Introduction. Case Study. Jason Laws. Principal Consultant WhereScape Consulting

Oracle Performance on M5000 with F20 Flash Cache. Benchmark Report September 2011

Experiences of Global Temporary Tables in Oracle 8.1

CC-IN2P3: A High Performance Data Center for Research

Data Warehouse Tuning. Without SQL Modification

20762B: DEVELOPING SQL DATABASES

Oracle: From Client Server to the Grid and beyond

Oracle Tables TECHGOEASY.COM

CAST(HASHBYTES('SHA2_256',(dbo.MULTI_HASH_FNC( tblname', schemaname'))) AS VARBINARY(32));

CERN Lustre Evaluation

ORACLE 11gR2 DBA. by Mr. Akal Singh ( Oracle Certified Master ) COURSE CONTENT. INTRODUCTION to ORACLE

Chapter 2. DB2 concepts

Eternal Story on Temporary Objects

Oracle Database 11g for Experienced 9i Database Administrators

Optimizing Testing Performance With Data Validation Option

Developing SQL Databases

Oracle Architectural Components

SQL Interview Questions

Sanity-check the operating systems of all machines involved with user performance. By sanity-checking. Two of the biggest

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

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

Performance Optimization for Informatica Data Services ( Hotfix 3)

Oracle Notes Part-5. Two Types of Cursor : 1)Implicit Cursor

AliEn Resource Brokers

Optimizing Insert Performance - Part 1

Creating and Managing Tables Schedule: Timing Topic

Oracle 1Z Oracle Database 10g: Administration II. Download Full Version :

Spark and HPC for High Energy Physics Data Analyses

Anthony AWR report INTERPRETATION PART I

From raw data to new fundamental particles: The data management lifecycle at the Large Hadron Collider

Improving Packet Processing Performance of a Memory- Bounded Application

Survey of Oracle Database

Manual Trigger Sql Server 2008 Insert Multiple Rows

Question No : 1 Which three statements are true regarding the use of the Database Migration Assistant for Unicode (DMU)?

Exadata Implementation Strategy

Built for Speed: Comparing Panoply and Amazon Redshift Rendering Performance Utilizing Tableau Visualizations

Evolution of Database Systems

ATLAS PILE-UP AND OVERLAY SIMULATION

State of the Dolphin Developing new Apps in MySQL 8

Scaling To Infinity: Partitioning Data Warehouses on Oracle Database

What's New in MySQL 5.7?

Oracle Database 18c and Autonomous Database

Top 5 Issues that Cannot be Resolved by DBAs (other than missed bind variables)

Deferred High Level Trigger in LHCb: A Boost to CPU Resource Utilization

Ideas for evolution of replication CERN

Daily, Weekly or Monthly Partitions? A discussion of several factors for this important decision

Transcription:

23 rd Nov 2017, DOAG conference, Nuremberg (Germany) Top-level DB design for Big Data in ATLAS Experiment at CERN Gancho Dimitrov, Petya Vasileva, Elizabeth Gallas, on behalf of the ATLAS Collaboration

About Us Elizabeth A physicist by training and a database developer by experience: Working with DBAs to design and optimize schemas and applications to suit the needs of large scientific experiments. Petya A software developer currently focusing on implementing applications which help DBAs and developers in their everyday work. She is also involved in providing support for the databases at ATLAS. Gancho Has a liaison role between the CERN IT database services and the ATLAS database developers community. His main focus is on database schema design, data management and performance tuning. 2

Outline Introduction to LHC and ATLAS experiment The EventIndex project а catalog of particle collision events Requirements Challenges Technical solutions Conclusions 2015 December 2016 March 3

CERN CERN - European Organization for Nuclear Research founded in 1954. Situated on the French-Swiss border near Geneva 2500 staff members work at CERN as personnel 12 000 more researchers from institutes world-wide International relations of CERN. CERN member states: 22 c. Accession in progress: 3 c. Associate members and Candidates: 4 c. Observers: 2 c. + EU + UNESCO + JINR Cooperation agreement: 37 c. Scientific contacts: 19 c. 4

5

LHC LHC (Large Hadron Collider) is the World s Largest Particle Accelerator. 27km ring of superconducting magnets 100m beneath the France Switzerland border 2 high-energy particle beams travel at close to the speed of light before they are made to collide 600M collisions per second 6

ATLAS detector ATLAS is a particle physics experiment that is searching for new discoveries in the head-on collisions of protons of extraordinarily high energy. Inner Detector Calorimeter Magnet System 25m Over 3000 scientists from 38 countries are taking part in the ATLAS experiment alone. Muon Spectrometer 44m 7

ATLAS experiment data taking video 8

Particle collisions data Datasets Files EventIndex is a catalogue containing information about the basic properties of event data as well as references to its storage location. Events Files are grouped into datasets Events are grouped into files Particle collisions are called Events 9

Event attributes Event Unique Identifier EVENT NUMBER Event numbers within a dataset are unique identifiers of particle collision events GUID2 GUID1 Event BUNCHID LUMI BLOCKN File identifier : GUID (Globally Unique Identifier) GUIDs are usually stored as 128-bit values, and are commonly displayed as 32 hexadecimal digits with groups separated by hyphens, such as: GUID0 GUID example: 21EC2020-3AEA-4069-A2DD-08002B30309D Event File Identifiers 10

Dataset attributes A unique dataset name is composed by 6 attributes AMI tag data type project & beam energy Dataset processing step run number trigger stream NUMBER OF DATASETS 18000 16000 14000 12000 10000 8000 6000 4000 2000 0 17134 15414 10342 7897 4944 228 0-5 К 5 К - 50 К 50 К - 500 К 500 К - 5 М 5 М - 100 М 100 М+ NUMBER OF EVENTS Expected indexed datasets per year > 15 000 11

Dataflow Data from a Hadoop system is loaded in the Oracle RDBMS All data is dumped into a plain table no constraints, no indices Oracle jobs verify, optimize & copy data to the destination tables Hadoop GUI Import process Staging tables in Oracle Oracle Scheduler Jobs Destination: Oracle tables 12

Oracle RDBMS and HW specs Main database role Oracle version Post data-taking analysis 11.2.0.4 (DB in force logging mode) # DB nodes 3 DB volume 37 TB # DB schemes 172 HW specs CPU Intel E5-2630 v4 @ 2.2GHz - 20 cores per node RAM 512 GB Per host 2 x 10 GigE for storage and cluster access NetApp NAS storage with 1.5 TB SSD cache 13

Project requirements q Store large amount of rows tens of billions per year q Remove large amount of rows if dataset is obsolete or its content has to be replaced. q Guarantee uniqueness of events within each dataset q Ensure fast and consistent data upload of large amount of rows (10s-100s million of rows) q Crosscheck data with other systems q Detect rows (events) duplication q Retrieve file identifiers (GUIDs) in fraction of a second 14

Challenges 1. Large amount of rows require large disk volume plus significant index overhead 2. Achieve high-speed data load & reduce undo and redo generation 3. Automatic handling in case of uniqueness violation 4. Provide simple way for querying events data 5. Remove large amount of rows with minimum DB footprint 6. Have adequate table stats gathering policy 7. Optimize data retrieval & guarantee queries execution plan stability 15

Challenge 1 Significant amount of disk space - On average 210 bytes per row - 1B rows = at least 200 GB without the index overhead 16

Approach for challenge 1 (1) Idea: study, test and get to acceptable level of data normalization to minimize data redundancy. Unique Key Primary Key Parent table with dataset definitions and child table having dataset content Dataset name uniqueness guaranteed by an Oracle unique constraint Dataset definition gets unique ID (dataset_id) from a DB sequence object Improvement: the AVG row length is reduced from 210 bytes to 130 bytes. D A T A S E TS PARENT TABLE DATASET_ID PROJECT RUNNUMBER STREAMNAME PRODSTEP DATATYPE AMITAG E V E N TS CHILD TABLE DATASET_ID EVENTNUMBER LUMIBLOCKN BUNCHID GUID0 GUID1 GUID2 80 bytes in the parent table 130 bytes in the child table (vast dataset range: from tens of rows to 100s of million of rows per dataset) 17

Approach for challenge 1 (2) Idea: explore Oracle data types The three file identifiers (GUIDs) of each event is with fixed length : 36 chars. 3 GUIDs in row = 108 bytes when using Oracle char data type Question: Could we shorten the 130 bytes row by using other Oracle data types? Answer: Yes, by taking advantage of the raw data type GUIDs type RAW 16 bytes GUIDs type CHAR < 36 bytes Store GUIDs of data type RAW HEXTORAW(REPLACE(GUID, '-', '')) Improvement: AVG length of child table row is reduced to 70 bytes E V E N TS CHILD TABLE DATASET_ID NUMBER(10,0) EVENTNUMBER NUMBER(10,0) LUMIBLOCKN NUMBER(10,0) BUNCHID NUMBER(10,0) GUID0 CHAR GUID1 CHAR GUID2 CHAR GUID0 GUID1 GUID2 RAW RAW RAW 18

Approach for challenge 1 (3) Idea: explore the Oracle Basic and OLTP compression (de-duplication within data block of 8KB) Test with 11 billion rows PCTFREE 0 setting: Compression AVG space per row Table size OLTP 19.6 bytes 201 GB Basic 19 bytes 195 GB Improvement : The AVG row length is reduced to 20 bytes. q Goal achieved: Disk space usage is reduced significantly Instead of 200 GB per 1B rows, only 20 GB are needed. 19

Challenge 2 Transactions could be large. How to achieve satisfactory speed? - The logical unit of data is a dataset being a group of unique identifiers of particle collision events - Dataset can have from few 10s of events to 100s million events (rows) 20

Approach for challenge 2 Idea: 1. Insert raw events data into a staging table without any normalization, use char data type for the GUIDs (AVG row length = 210 bytes), no index overhead. Use list partitioning for having a dedicated partition per Dataset. E V E N TS CHILD TABLE DATASET_ID NUMBER(10,0) EVENTNUMBER NUMBER(10,0) LUMIBLOCKN NUMBER(10,0) BUNCHID NUMBER(10,0) GUID0 RAW GUID1 RAW GUID2 RAW 2. Use PLSQL procedure for loading data from the staging table to the child table. NO INDEX NO CONSTRAINTS LIST PARTITIONED BY DATASET_ID Goal: Achieve consistency, high speed in rows insert, minimum disk space usage, minimum undo usage. Question: OLTP or Basic compression to be used? E V E N TS STAGING TABLE DATASET_ID NUMBER(10,0) EVENTNUMBER NUMBER(10,0) LUMIBLOCKN NUMBER(10,0) BUNCHID NUMBER(10,0) GUID0 CHAR(36 BYTE) GUID1 CHAR(36 BYTE) GUID2 CHAR(36 BYTE) 21

Challenge 2 : setup without compression Test: Bulk insert into the child table, no constraints and no compression Test INSERT /*+ append*/ INTO child_table not having PK, no FK, no compression Results: 1. Insert speed 202K rows/sec 2. Undo is not used Test INSERT /*+ append*/ INTO child_table having PK, no FK, no compression Results: 1. Insert speed 113K rows/sec 2. 1 GB undo used per 54 million rows (used only for the PK index build) 22

Challenge 2 : OLTP compression (1) Test Child table with OLTP compression. Conventional insert Bulk insert INSERT INTO child_table SELECT, HEXTORAW(REPLACE(GUID0, '-', '')), HEXTORAW(REPLACE(GUID1, '-', '')), HEXTORAW(REPLACE(GUID2, '-', '')) FROM staging_table WHERE DATASET_ID = ; or INSERT /*+ append*/ INTO child_table SELECT, HEXTORAW(REPLACE(GUID0, '-', '')), HEXTORAW(REPLACE(GUID1, '-', '')), HEXTORAW(REPLACE(GUID2, '-', '')) FROM staging_table WHERE DATASET_ID = ; Same result: 1. Insert speed 7K rows/sec 2. 1GB undo per 3 million inserted rows 3. USED_UREC = 2x number of inserted rows because of the PK E V E N TS CHILD TABLE DATASET_ID FK PK EVENTNUMBER LUMIBLOCKN BUNCHID GUID0 GUID1 GUID2 PARENT TABLE DATASET_ID PROJECT RUNNUMBER STREAMNAME PRODSTEP DATATYPE AMITAG PK UK D A T A S E TS 23

Challenge 2 : Basic compression Test Child table with Basic compression. Test bulk insert (INSERT /*+ append*/ INTO ) Results: 1. Insert speed 13K rows/sec 2. 1GB undo per 6 million inserted rows 3. USED_UREC = 2x number of inserted rows because of the PK 4. Compression does not kick in (the AVG row length is 70 bytes). Why? E V E N TS CHILD TABLE DATASET_ID FK PK EVENTNUMBER LUMIBLOCKN BUNCHID GUID0 GUID1 GUID2 PARENT TABLE DATASET_ID PROJECT RUNNUMBER STREAMNAME PRODSTEP DATATYPE AMITAG PK UK D A T A S E TS Note: for the largest dataset we have 630 million rows, we would need 105 GB undo and about 14 hours to complete. 24

Challenge 2 : Basic compression (2) Question: Why the data compression does not kick in? Why still so much undo is used? Test INSERT /*+ append*/ INTO child_table having PK, no FK and with Basic compression Results: 1. Insert speed 130K rows/sec 2. 1 GB undo used per 54 million rows (used only for the PK index build) 3. Compression kicks in and the average space used per row is 20 bytes E V E N TS CHILD TABLE DATASET_ID EVENTNUMBER LUMIBLOCKN BUNCHID FK PK PARENT TABLE DATASET_ID PROJECT RUNNUMBER STREAMNAME PRODSTEP DATATYPE Finding: When having bulk insert on table with FK and Basic compression, Oracle silently performs conventional insertion, does not compress the data and generates a lot of undo. GUID0 GUID1 GUID2 AMITAG PK UK D A T A S E TS 25

Challenge 2 : applied solution q Goal achieved: data consistency, high speed in rows insert, minimum used disk space, minimum undo and redo footprint on the DB Example: to load 100 million rows within a single transaction: Elapsed time is about 13-14 min (insert rate 120-130K rows/sec) Table segment about 2GB, index segment about 2GB Used undo < 2 GB Compromises: No parent-child table relationship enforcement via DB foreign key. This is acceptable as the data loading is done only by a PLSQL procedure that has the necessary pre-checks in. Other idea is to try with FK of type deferred rely. Data load serialization because of the INSERT /*+ append*/ INTO child_table Only a single session can load data at a given time. This is acceptable because of the achieved high insert rate. Or potentially we could use parallelism in the bulk insert. 26

Challenge 3 Automatic handling in case of key uniqueness violation - Application logic implies that raised ORA-00001: unique constraint violated error on the child table must not rollback the transaction, but any rows with duplicated key(s) have to be stored aside into a separate table. 27

Tested approach for challenge 3 Idea: store aside the duplicated rows using the LOG ERRORS INTO... clause Actions: Create errorlog table using the DBMS_ERRLOG.CREATE_ERROR_LOG method INSERT /*+ append*/ INTO child_table SELECT FROM staging_table LOG ERRORS INTO log_table REJECT LIMIT UNLIMITED; Findings: that approach works as standalone statement in the SQL scope. The " LOG ERRORS INTO REJECT LIMIT UNLIMITED " does not work within a PLSQL proc. The ORA-00001: unique constraint violated on the Child table PK is returned. 28

Tested approach for challenge 3 (2) Idea: use the "ignore_row_on_dupkey_index" hint ignore_row_on_dupkey_index(tab_name,table_pk_name) or ignore_row_on_dupkey_index(tab_name(col1, col2)) INSERT /*+ ignore_row_on_dupkey_index(tab_name(col1, col2)) */ INTO child_table SELECT FROM staging_table Findings: That approach works only for datasets with few hundred rows. For datasets with thousands of rows, Oracle corrupts the PK index structure. Counting rows in a dataset, computes more rows than inserted (details on the next slide). 29

Surprising result with ignore_row_on_dupkey_index Test: Find the number of occurrences of the unique values SELECT col1, col2, count(*) FROM child_table WHERE DATASET_ID = GROUP BY col1, col2 HAVING count(*) > 1; Results: 18395 2295389 2 18395 2296722 3 18395 2296824 3 18395 2252272 4 18395 2284925 2 Problem: deletion of rows from the dataset raised an error of corruption in the index DELETE from child_table WHERE dataset_id = ORA-08102: index key not found, obj# 20667461, file 658, block 77946491 (3) 30

Resolution of challenge 3 (3) Solution: sequence of actions encoded into a PLSQL procedure Actions: 1. Check whether the dataset in the staging table has duplicates based on the destination table PK columns 2. Insert into the child table all rows that do not have duplication 3. Insert into a dedicated table all duplicated rows from the staging table 4. Insert into the child table a representative row from each group of duplication q Goal achieved: Duplicated rows are automatically detected and stored separately 31

Challenge 4 Provide simplification for GUIDs retrieval - GUID data types are of type RAW in order to save space, however the application must get the GUID values as strings 32

Approach for challenge 4 Idea: Define virtual columns for the GUIDs on table level ready to be used in any query. Advantages: values are computed on a fly, simplifies application queries (clearer SQL code) EXAMPLE: SELECT GUID0_CHAR, GUID1_CHAR, GUID0_CHAR FROM child_table q Goal achieved: Shorter and simpler SQL queries CREATE TABLE child_table (, GUID0 RAW(16),GUID1 RAW(16),GUID2 RAW(16),GUID0_CHAR as (SUBSTR(RAWTOHEX(GUID0),1,8) '-' SUBSTR(RAWTOHEX (GUID0),9,4) '-' SUBSTR(RAWTOHEX (GUID0),13,4) '-' SUBSTR(RAWTOHEX (GUID0),17,4) '-' SUBSTR(RAWTOHEX (GUID0),21,12)),GUID1_CHAR as (SUBSTR(RAWTOHEX(GUID1),1,8) '-' SUBSTR(RAWTOHEX (GUID1),9,4) '-' SUBSTR(RAWTOHEX (GUID1),13,4) '-' SUBSTR(RAWTOHEX (GUID1),17,4) '-' SUBSTR(RAWTOHEX (GUID1),21,12)),GUID2_CHAR as (SUBSTR(RAWTOHEX(GUID2),1,8) '-' SUBSTR(RAWTOHEX (GUID2),9,4) '-' SUBSTR(RAWTOHEX (GUID2),13,4) '-' SUBSTR(RAWTOHEX (GUID2),17,4) '-' SUBSTR(RAWTOHEX (GUID2),21,12)) 33

Challenge 5 Any obsolete dataset (small or large) has to be removed from the database - Deletion of rows from already-compressed data takes considerable time and moreover generate considerable amount of undo and redo. - Delete of 10s or 100s of millions rows takes hours or it may not succeed because of the needed significant undo. 34

Approach for challenge 5 Idea: do not delete row by row, but scratch a complete dataset in a straightforward way: partition the child table in a way appropriate for simple partition removal. Best approach: LIST partitioning LIST PARTITIONED BY DATASET_ID CREATE TABLE child_table ( DATASET_ID NUMBER(10,0),... CONSTRAINT cons_name PRIMARY KEY (..) using index COMPRESS 1 LOCAL ) pctfree 0 COMPRESS BASIC tablespace &&m_tbs PARTITION BY LIST(DATASET_ID) ( PARTITION DATASET_ZERO VALUES(0) ); E V E N TS CHILD TABLE DATASET_ID EVENTNUMBER LUMIBLOCKN BUNCHID GUID0 GUID1 PK GUID2 35

List partitioning: an operational challenge Caution: List partitioning is appropriate, but is an operational challenge in Oracle 11g as partitions must be pre-created for each new partition key value. This is a burden as new datasets have to be registered any time in the system. In-house created solution: Partition is automatically created for the staging and the final child table whenever a new dataset (partition key value) is created into the parent table. After insert row level trigger fires and executes a PLSQL procedure responsible for ALTER TABLE ADD PARTITION Each partition creation action is logged into a dedicated logging table 36

Partition removal setup Setup: Staging table: as the nature of the data is transient, partitions are removed automatically on chosen interval via an Oracle scheduler job Child table: datasets with flag obsolete are removed automatically by a scheduler job: relevant partition is dropped. Result: The operation is very efficient as table and index partitions are removed without a need for expensive undo and redo. q Goal achieved: Obsolete data is automatically & efficiently removed. 37

Challenge 6 Statistics gathering on table with billions of rows - Gather statistics on very large table is time and resource consuming - What level of statistics are enough for the use cases we have? 38

Stats gathering Problem: The Oracle auto stats gathering is not appropriate for the partitioned child table with billions of rows because: 1. By default it gathers stats on partition level and on global level 2. It may decide to compute histograms for some of the columns 3. New stats may appear at any time Solution: Better to have customized settings for the stats gathering on certain tables because : DBAs and developers know best what and when has to be updated Partition level stats lead to undesired execution plan changes when using bind variables. Remark: Seen behavior of CBO choosing full partition scan, because of tiny partition segment, instead of PK unique scan. Reusing such plan on partition with 100s millions of rows is a disaster. 39

Customized stats gathering Setup: 1. Global table stats only exec DBMS_STATS.SET_TABLE_PREFS( owner, table, GRANULARITY, GLOBAL ); 2. Forbid histograms exec DBMS_STATS.SET_TABLE_PREFS( owner, table, METHOD_OPT, FOR ALL COLUMNS SIZE 1 ); 3. Degree of parallelism in the stats gathering exec DBMS_STATS.SET_TABLE_PREFS( owner', table', 'DEGREE', 2 ); 4. Lock statistics exec DBMS_STATS.LOCK_TABLE_STATS( owner, table ); 5. Gather statistics with scheduler job monthly with force=true option. 40

More about stats Oracle computes stats on the virtual columns Question: Virtual columns do not take space but AVG_COL_LEN is computed for them. Their AVG_COL_LEN is added to the row length AVG_ROW_LEN. Why? Findings: In our case with the child table data, Oracle stats gathering comes up with AVG_ROW_LEN = 180 bytes (while in reality on average each row takes 20 bytes) because of the compression and raw data type columns and the virtual columns on top of them. Stats gathering Row length 180 bytes Reality Row length 20 bytes q Goal achieved: Sufficient level of statistics by customized setup is in place 41

Challenge 7 Performance of data retrieval & Query execution plan stability - Main use case: give me the GUIDs (file identifiers) for a list of proton collision events [1.thousands events] from list of LHC runs [1..tens or hundreds of runs] Note: Run number is part of the dataset name 42

Query with long IN list Question: How to compose a SQL statement that could have hundreds of IN list values? Caution: 1. Having long IN list with hundreds of literals makes difficult SQL statement parsing and execution plan stability is at risk. SELECT FROM parent_table pt, child_table ct WHERE pt.dataset_id = ct.dataset_id AND (RUNNUMBER, EVENTNUMBER) IN ( (279685, 569724665), (279685, 994915396), (279685, 1058293500), (, ), ); 2. Long IN list with bind variables is not good option as well 3. The length of the IN list is not known. 43

Instead of IN list use temporary table Idea: instead of composing long IN list with values, the client session inserts values into an Oracle temporary table, joins it with the other tables, gets the result and commits (in order to clean the TMP data). CREATE GLOBAL TEMPORARY TABLE tmp_table (run_id NUMBER(10), event_id NUMBER(10)) ON COMMIT DELETE ROWS; Idea: simplify the JOIN between the three tables ( dataset parent table, dataset child table, TMP table ), by encapsulating the query into a read-only view object. CREATE OR REPLACE VIEW... AS SELECT FROM parent_table, child_table, tmp_table WHERE... WITH READ ONLY; 44

Advantages of using view objects 1. Simplifies the application queries 2. Certain complexity is hidden for the client applications 3. Only the needed columns are exposed to the client applications 4. Instructions (hints) can be specified in the view definition. Such instructions are good for ensuring execution plan stability. Example : We want Oracle to choose access path via index range scan, and we do not want index partition fast full scan. INDEX_RS_ASC(table_alias(datasetID,eventID)) NO_INDEX_FFS(table_alias(datasetID, eventid)) 45

Data retrieval performance Performance tests with 100 users show AVG about 2s for requests of 2000 run-event pairs 46

System overview Nov 2017 Tables 2,5 TB Indices 2,2 TB 11 B 16 B 18 B 22 B 23 B In production 31 B Total number of rows (events) 39 B 42 B 48 B 71 B 112 B 120 B 2016 2017 Jan Mar May July Sept Nov Jan Mar May July Sept Nov 43,282 55,455 56,320 17,403 18,683 20,039 21,417 22,319 24,024 26,293 26,629 27,071 Total number of datasets (= table partitions) 47

Conclusions q Information about the ATLAS particle collision events is well structured and stored in efficient way in the Oracle RDBMS q Serious challenges are addressed in proper way q The system is simple, robust and reliable q The database handles seamlessly tens of billions rows per year 48

Thank you for your interest! gancho@cern.ch, petya@cern.ch, elizabeth.gallas@physics.ox.ac.uk