SlideShare une entreprise Scribd logo
1  sur  32
(R)DBMS
Advanced techniques
Bogdan Kecman
MySQL Principal Technical Engineer @ORACLE
bogdan.kecman@oracle.com
bogdan.kecman@bad-team.net
GrowIT, Novi Sad, December 2018.
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied
upon in making purchasing decisions. The development, release, and timing of any
features or functionality described for Oracle’s products remains at the sole discretion of
Oracle.
2
3
Follow the talk: https://joind.in/talk/c03bc
4
Speed!!! Availability?!? Reliability?!? Scalability?!
5
Total Cost of Operation
Conventional setup
6
PRESENTATION LAYER
CLIENTS
MIDDLEWARE
LAYER LOGIC
INTEGRATION
PLUGINS and ADAPTERS
WRAPPERS
EVENT SOURCES BUSINESS MODULES RESOURCE MGM
MAGIC
MONITORING
DATA STORAGE
?
MAGIC?
• Education?
• Information volume?
• Information complexity?
• Not sexy enough?
• Money not good?
• Requirement?
Why is so little attention given to monitoring and data storage?
7
How to uncover the MAGIC?
●
Understand the problem
●
Check out all available tools
●
Think OUTSIDE THE BOX but KNOW THE BOX!!!
Any sufficiently advanced technology is indistinguishable from magic!
8
Problems?
●
Availability & Reliability – robustness
●
Scalability – “all directions”
●
Performance
●
TCO optimization
For every expert, there is an equal and opposite expert!
9
Know your tools
Any sufficiently advanced technology is indistinguishable from magic!
10
Examples – MySQL
MySQL environment can be very complex or very simple!
11
MySQL Cluster Data Nodes InnoDB SE s1 SE s2MyISAM
Examples – MySQL InnoDB
●
SQL (via MySQL connector/php,java,ruby,python..., odbc, C-API..)
●
MEMCACHED (via memcached plugin on the mysqld)
●
InnoDB API (C-API)
How can you access data stored in InnoDB table?
12
Examples – MySQL HTTP plugin
●
SQL over HTTP(s)
– http(s)://host:port/sql/SELECT+%2A+FROM+t1+ORDER+BY+f1
●
CRUD (aka REST) over HTTP(s)
– http(s)://host:port/crud/database/table/primaryKey
●
JSON over HTTP(s)
– http(s)://host:port/doc/database/table
– http(s)://host:port/doc/database/table/key
Other ways to access data?
13
Results – MySQL InnoDB
●
70000 TPS vs 10000 TPS
14
Examples – MySQL Cluster
●
SQL (via MySQL connector/php,java,ruby..., odbc, MySQL C-API..)
●
MEMCACHED (add ndbcluster driver to memcached server)
●
ClusterJ, JPA, ClusterJPA, LDAP
●
ndbAPI (C/C++ API)
MySQL Cluster is a system that runs 80% of mobile traffic in the World!
15
ClusterJ
MySQL
JDBC
Apps
JPA
JNI
Python Ruby
ClusterJPA
Apps Apps Apps Apps Apps
Node.js
JSON
Apps
mod-ndb
Apache
Apps
ndb-eng
Memcached
Apps Apps
NDB API (C++)
MySQL Cluster Data Nodes
Apps
PHP PERL
Apps
Examples – MySQL Cluster
●
SQL (via MySQL C-API or JDBC..) to create and backup/restore schema (DDL)
●
ClusterJ, LDAP to access and manipulate data (DML)
MySQL Cluster how are Telco’s accessing it
16
Visitor Location Register
Authentication Center
Home Location Register
NDB API (C++)
MySQL Cluster Data Nodes
Management
Apps
C API / JDBC ClusterJ
JNIMySQL LDAP
Examples – MySQL Cluster as persistent memcached
Memcached is fast as very usable, can we get similar performance but keep
data persistent ?
17
hash key
to find data
Memcache
httpd memcached
memcached
memcached
memcache key
PHP/Perl
friends:12389
MySQL
Cluster
Data Nodememcached
Memcache
Client
Application
MySQL
Cluster
Data Node
NDB Engine
Traditional
Persistent with MCCGE
Results - MySQL Cluster as persistent memcached
memcachetest -t 2 -M 7000 -c 25000
18
Results – MySQL Cluster SQL vs NDB API
Reads / seconds – note logarithmic Y axis
19
PostgreSQL Columnar Store
●
Compression
●
Column Projection
●
Different / no Indexes
Have Analytics Workload, running trough OLAP cubes
20
PostgreSQL GPU Acceleration
●
CUDA 7.0 or later
●
Accelerates sequential scan, hash based table join and aggregate
functions
PG Strom
21
Results – PostgreSQL
Data courtesy of Nikola Krgović from Twin Star Systems
22
PSQL Columnar GPU GPU+Columnar
test1 10.4 143.3 9.1 28.1
test2 45.6 41.5 36.1 41.2
test3 825 820 859 832
Tokutek - TokuDB Storage Engine, TokuMX
Fractals anyone?
23
Server monitoring & profiling
●
MySQL Enterprise Monitor
●
MySQL SYS schema
●
pgBadger
●
pgFouine
●
Nagios and Zabbix plugins to monitor (r)DBMS state
I believe in having each device secured and monitoring each device, rather
than just monitoring holistically on the network, and then responding in
short enough time for damage control.
24
DB Model optimization
●
First Normal Form
●
Second Normal Form
●
Third Normal Form
●
Boyce – Codd normal form
●
Fourth Normal Form
●
5th
, Domain Key and 6th
Normal Form.
In order to denormalize db model you first need to achieve it’s NF
25
Query profiling and tuning / optimization
●
ORM
●
ORM?
●
ORM REALLY?
●
Profile queries!
●
Choose a right (R)DBMS
●
Use CTE (common table expressions)
Do you really trust ORM to write a query for you?
26
Example - Query profiling and tuning / optimization
Original:
DELETE FROM t1 WHERE id NOT IN (SELECT id FROM t1_data);
Query time 3.5s - 5s
Optimized to:
DELETE t1 FROM t1 LEFT OUTER JOIN t1_data
ON msg.id=msg_data.id WHERE t1_data.id IS NULL;
Optimized query time below 1.5s! More then 3 times faster!
Large number of entries inside IN() clause is not smart
27
Example - Query profiling and tuning / optimization
Do you really trust ORM to write a query for you?
28
Original query (ORM generated) takes 10 minutes to execute:
SELECT t1.wid,
t2.wname,
Date(t1.t_stamp) AS 'dateOnly',
t1.rpd + ( t1.runminpd / 60 ) AS 'PDRuntime',
Min(t1.t_stamp),
l.name,
fg.fieldgroupname
FROM arch.lfedata plc
LEFT JOIN arch.lfe_wellsites w
ON t1.wid = t2.id
LEFT JOIN arch.lfe_locations l
ON t2.locationid = l.id
LEFT JOIN arch.lfe_fieldgroups fg
ON l.fieldgroupid = fg.fieldgroupid
Example - Query profiling and tuning / optimization
Do you really trust ORM to write a query for you?
29
WHERE t1.t_stamp BETWEEN '2016-06-01 00:00:00' AND '2016-08-31 23:00:00'
AND quality_code = 192
AND t2.compreport = 1
GROUP BY t1.wid,
Date(t1.t_stamp)
UNION
(SELECT 2,
'NONE',
'2000-00-00 00:00:00',
0,
'2000-00-00 00:00:00',
'ZZ_NoName',
'NoFieldGroup'
ORDER BY name, wname, dateonly DESC);
Example - Query profiling and tuning / optimization
Do you really trust ORM to write a query for you?
30
Final optimized query takes 10 seconds to execute:
SELECT t.wid, t.wname, t. 'dateOnly',
plc.rpd +(plc.RunMinPD/60) as 'PDRuntime', l.name, fg.FieldGroupName
FROM (SELECT plc.wid, DATE(plc.t_stamp) as 'dateOnly', MIN(lfedata_ndx) as 'ndx', t2.wname, t2.locationId
FROM arch.lfedata plc INNER JOIN arch.lfe_wellsites w ON plc.wid = t2.id
WHERE plc.t_stamp BETWEEN '2016-06-01 00:00:00' AND '2016-08-31 23:55:00'
AND plc.quality_code = 192
AND t2.compReport = 1
GROUP BY plc.wid, DATE(plc.t_stamp) ) t
INNER JOIN arch.lfedata plc
ON t.ndx = plc.lfedata_ndx
LEFT JOIN arch.lfe_locations l
ON t.locationId = l.id
LEFT JOIN arch.lfe_fieldgroups fg
ON l.fieldGroupId = fg.FieldGroupId;
Sources
●
Voxxed Days – Bogdan Kecman: https://youtu.be/u0A0i9OEohs
●
mDevDay – Bogdan Kecman: https://youtu.be/0vnSchjQHoE
●
Data Science – Nikola Krgović: https://youtu.be/MhE1skm0y7k
●
MySQL Documentation: https://dev.mysql.com/doc/
●
PostgreSQL Documentation: https://www.postgresql.org/docs/
●
The one book to rule them all: https://www.amazon.com/dp/0321197844/
●
TokuDB Fractal Index WP: http://www.miniuri.com/306
The only source of knowledge is experience!
31
HVALA!
Bogdan Kecman
MySQL Principal Technical Engineer
bogdan.kecman@oracle.com
bogdan.kecman@bad-team.net
GrowIT, Novi Sad, December 2018.

Contenu connexe

Tendances

Cassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapestCassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapestDuyhai Doan
 
RSA NetWitness Log Decoder
RSA NetWitness Log DecoderRSA NetWitness Log Decoder
RSA NetWitness Log DecoderSusam Pal
 
TRHUG 2015 - Veloxity Big Data Migration Use Case
TRHUG 2015 - Veloxity Big Data Migration Use CaseTRHUG 2015 - Veloxity Big Data Migration Use Case
TRHUG 2015 - Veloxity Big Data Migration Use CaseHakan Ilter
 
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)Geoffrey De Smet
 
openTSDB - Metrics for a distributed world
openTSDB - Metrics for a distributed worldopenTSDB - Metrics for a distributed world
openTSDB - Metrics for a distributed worldOliver Hankeln
 
23 October 2013 - AWS 201 - A Walk through the AWS Cloud: Introduction to Ama...
23 October 2013 - AWS 201 - A Walk through the AWS Cloud: Introduction to Ama...23 October 2013 - AWS 201 - A Walk through the AWS Cloud: Introduction to Ama...
23 October 2013 - AWS 201 - A Walk through the AWS Cloud: Introduction to Ama...Amazon Web Services
 
Webscale PostgreSQL - JSONB and Horizontal Scaling Strategies
Webscale PostgreSQL - JSONB and Horizontal Scaling StrategiesWebscale PostgreSQL - JSONB and Horizontal Scaling Strategies
Webscale PostgreSQL - JSONB and Horizontal Scaling StrategiesJonathan Katz
 
Базы данных. HDFS
Базы данных. HDFSБазы данных. HDFS
Базы данных. HDFSVadim Tsesko
 
Beyond Shuffling and Streaming Preview - Salt Lake City Spark Meetup
Beyond Shuffling and Streaming Preview - Salt Lake City Spark MeetupBeyond Shuffling and Streaming Preview - Salt Lake City Spark Meetup
Beyond Shuffling and Streaming Preview - Salt Lake City Spark MeetupHolden Karau
 
SequoiaDB Distributed Relational Database
SequoiaDB Distributed Relational DatabaseSequoiaDB Distributed Relational Database
SequoiaDB Distributed Relational Databasewangzhonnew
 
A fast introduction to PySpark with a quick look at Arrow based UDFs
A fast introduction to PySpark with a quick look at Arrow based UDFsA fast introduction to PySpark with a quick look at Arrow based UDFs
A fast introduction to PySpark with a quick look at Arrow based UDFsHolden Karau
 
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph Ceph Community
 
Tweaking performance on high-load projects
Tweaking performance on high-load projectsTweaking performance on high-load projects
Tweaking performance on high-load projectsDmitriy Dumanskiy
 
Chronix Poster for the Poster Session FAST 2017
Chronix Poster for the Poster Session FAST 2017Chronix Poster for the Poster Session FAST 2017
Chronix Poster for the Poster Session FAST 2017Florian Lautenschlager
 
MongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to RedisMongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to RedisJason Terpko
 
Handling 20 billion requests a month
Handling 20 billion requests a monthHandling 20 billion requests a month
Handling 20 billion requests a monthDmitriy Dumanskiy
 
Cassandra Community Webinar | In Case of Emergency Break Glass
Cassandra Community Webinar | In Case of Emergency Break GlassCassandra Community Webinar | In Case of Emergency Break Glass
Cassandra Community Webinar | In Case of Emergency Break GlassDataStax
 
OpenTSDB 2.0
OpenTSDB 2.0OpenTSDB 2.0
OpenTSDB 2.0HBaseCon
 

Tendances (20)

Cassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapestCassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapest
 
RSA NetWitness Log Decoder
RSA NetWitness Log DecoderRSA NetWitness Log Decoder
RSA NetWitness Log Decoder
 
TRHUG 2015 - Veloxity Big Data Migration Use Case
TRHUG 2015 - Veloxity Big Data Migration Use CaseTRHUG 2015 - Veloxity Big Data Migration Use Case
TRHUG 2015 - Veloxity Big Data Migration Use Case
 
JEEConf. Vanilla java
JEEConf. Vanilla javaJEEConf. Vanilla java
JEEConf. Vanilla java
 
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)
Pushing the rule engine to its limits with drools planner (parisjug 2010-11-09)
 
openTSDB - Metrics for a distributed world
openTSDB - Metrics for a distributed worldopenTSDB - Metrics for a distributed world
openTSDB - Metrics for a distributed world
 
23 October 2013 - AWS 201 - A Walk through the AWS Cloud: Introduction to Ama...
23 October 2013 - AWS 201 - A Walk through the AWS Cloud: Introduction to Ama...23 October 2013 - AWS 201 - A Walk through the AWS Cloud: Introduction to Ama...
23 October 2013 - AWS 201 - A Walk through the AWS Cloud: Introduction to Ama...
 
Webscale PostgreSQL - JSONB and Horizontal Scaling Strategies
Webscale PostgreSQL - JSONB and Horizontal Scaling StrategiesWebscale PostgreSQL - JSONB and Horizontal Scaling Strategies
Webscale PostgreSQL - JSONB and Horizontal Scaling Strategies
 
Базы данных. HDFS
Базы данных. HDFSБазы данных. HDFS
Базы данных. HDFS
 
Beyond Shuffling and Streaming Preview - Salt Lake City Spark Meetup
Beyond Shuffling and Streaming Preview - Salt Lake City Spark MeetupBeyond Shuffling and Streaming Preview - Salt Lake City Spark Meetup
Beyond Shuffling and Streaming Preview - Salt Lake City Spark Meetup
 
SequoiaDB Distributed Relational Database
SequoiaDB Distributed Relational DatabaseSequoiaDB Distributed Relational Database
SequoiaDB Distributed Relational Database
 
A fast introduction to PySpark with a quick look at Arrow based UDFs
A fast introduction to PySpark with a quick look at Arrow based UDFsA fast introduction to PySpark with a quick look at Arrow based UDFs
A fast introduction to PySpark with a quick look at Arrow based UDFs
 
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph
 
Tweaking performance on high-load projects
Tweaking performance on high-load projectsTweaking performance on high-load projects
Tweaking performance on high-load projects
 
Chronix Poster for the Poster Session FAST 2017
Chronix Poster for the Poster Session FAST 2017Chronix Poster for the Poster Session FAST 2017
Chronix Poster for the Poster Session FAST 2017
 
MongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to RedisMongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to Redis
 
Handling 20 billion requests a month
Handling 20 billion requests a monthHandling 20 billion requests a month
Handling 20 billion requests a month
 
Full Text Search in PostgreSQL
Full Text Search in PostgreSQLFull Text Search in PostgreSQL
Full Text Search in PostgreSQL
 
Cassandra Community Webinar | In Case of Emergency Break Glass
Cassandra Community Webinar | In Case of Emergency Break GlassCassandra Community Webinar | In Case of Emergency Break Glass
Cassandra Community Webinar | In Case of Emergency Break Glass
 
OpenTSDB 2.0
OpenTSDB 2.0OpenTSDB 2.0
OpenTSDB 2.0
 

Similaire à Bogdan Kecman Advanced Databasing

Bogdan Kecman INIT Presentation
Bogdan Kecman INIT PresentationBogdan Kecman INIT Presentation
Bogdan Kecman INIT Presentationarhismece
 
Intro to Spark development
 Intro to Spark development  Intro to Spark development
Intro to Spark development Spark Summit
 
Introduction to Spark Training
Introduction to Spark TrainingIntroduction to Spark Training
Introduction to Spark TrainingSpark Summit
 
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...Citus Data
 
[C12]元気Hadoop! OracleをHadoopで分析しちゃうぜ by Daisuke Hirama
[C12]元気Hadoop! OracleをHadoopで分析しちゃうぜ by Daisuke Hirama[C12]元気Hadoop! OracleをHadoopで分析しちゃうぜ by Daisuke Hirama
[C12]元気Hadoop! OracleをHadoopで分析しちゃうぜ by Daisuke HiramaInsight Technology, Inc.
 
Spark & Cassandra - DevFest Córdoba
Spark & Cassandra - DevFest CórdobaSpark & Cassandra - DevFest Córdoba
Spark & Cassandra - DevFest CórdobaJose Mº Muñoz
 
GPU Accelerated Data Science with RAPIDS - ODSC West 2020
GPU Accelerated Data Science with RAPIDS - ODSC West 2020GPU Accelerated Data Science with RAPIDS - ODSC West 2020
GPU Accelerated Data Science with RAPIDS - ODSC West 2020John Zedlewski
 
Road to Enterprise Architecture for Big Data Applications: Mixing Apache Spar...
Road to Enterprise Architecture for Big Data Applications: Mixing Apache Spar...Road to Enterprise Architecture for Big Data Applications: Mixing Apache Spar...
Road to Enterprise Architecture for Big Data Applications: Mixing Apache Spar...Databricks
 
Which DBMS and Why?
Which DBMS and Why?Which DBMS and Why?
Which DBMS and Why?Majid Azimi
 
Tales from the Field
Tales from the FieldTales from the Field
Tales from the FieldMongoDB
 
A Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
A Cassandra + Solr + Spark Love Triangle Using DataStax EnterpriseA Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
A Cassandra + Solr + Spark Love Triangle Using DataStax EnterprisePatrick McFadin
 
Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...
Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...
Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...TigerGraph
 
MariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance OptimizationMariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance OptimizationMariaDB plc
 
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...Codemotion
 
Robert Pankowecki - Czy sprzedawcy SQLowych baz nas oszukali?
Robert Pankowecki - Czy sprzedawcy SQLowych baz nas oszukali?Robert Pankowecki - Czy sprzedawcy SQLowych baz nas oszukali?
Robert Pankowecki - Czy sprzedawcy SQLowych baz nas oszukali?SegFaultConf
 
20170602_OSSummit_an_intelligent_storage
20170602_OSSummit_an_intelligent_storage20170602_OSSummit_an_intelligent_storage
20170602_OSSummit_an_intelligent_storageKohei KaiGai
 
Hybrid Transactional/Analytics Processing with Spark and IMDGs
Hybrid Transactional/Analytics Processing with Spark and IMDGsHybrid Transactional/Analytics Processing with Spark and IMDGs
Hybrid Transactional/Analytics Processing with Spark and IMDGsAli Hodroj
 
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...Alessandro Confetti
 
Best Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache SparkBest Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache SparkDatabricks
 
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...DataStax Academy
 

Similaire à Bogdan Kecman Advanced Databasing (20)

Bogdan Kecman INIT Presentation
Bogdan Kecman INIT PresentationBogdan Kecman INIT Presentation
Bogdan Kecman INIT Presentation
 
Intro to Spark development
 Intro to Spark development  Intro to Spark development
Intro to Spark development
 
Introduction to Spark Training
Introduction to Spark TrainingIntroduction to Spark Training
Introduction to Spark Training
 
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
 
[C12]元気Hadoop! OracleをHadoopで分析しちゃうぜ by Daisuke Hirama
[C12]元気Hadoop! OracleをHadoopで分析しちゃうぜ by Daisuke Hirama[C12]元気Hadoop! OracleをHadoopで分析しちゃうぜ by Daisuke Hirama
[C12]元気Hadoop! OracleをHadoopで分析しちゃうぜ by Daisuke Hirama
 
Spark & Cassandra - DevFest Córdoba
Spark & Cassandra - DevFest CórdobaSpark & Cassandra - DevFest Córdoba
Spark & Cassandra - DevFest Córdoba
 
GPU Accelerated Data Science with RAPIDS - ODSC West 2020
GPU Accelerated Data Science with RAPIDS - ODSC West 2020GPU Accelerated Data Science with RAPIDS - ODSC West 2020
GPU Accelerated Data Science with RAPIDS - ODSC West 2020
 
Road to Enterprise Architecture for Big Data Applications: Mixing Apache Spar...
Road to Enterprise Architecture for Big Data Applications: Mixing Apache Spar...Road to Enterprise Architecture for Big Data Applications: Mixing Apache Spar...
Road to Enterprise Architecture for Big Data Applications: Mixing Apache Spar...
 
Which DBMS and Why?
Which DBMS and Why?Which DBMS and Why?
Which DBMS and Why?
 
Tales from the Field
Tales from the FieldTales from the Field
Tales from the Field
 
A Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
A Cassandra + Solr + Spark Love Triangle Using DataStax EnterpriseA Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
A Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
 
Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...
Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...
Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...
 
MariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance OptimizationMariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance Optimization
 
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...
Perchè potresti aver bisogno di un database NoSQL anche se non sei Google o F...
 
Robert Pankowecki - Czy sprzedawcy SQLowych baz nas oszukali?
Robert Pankowecki - Czy sprzedawcy SQLowych baz nas oszukali?Robert Pankowecki - Czy sprzedawcy SQLowych baz nas oszukali?
Robert Pankowecki - Czy sprzedawcy SQLowych baz nas oszukali?
 
20170602_OSSummit_an_intelligent_storage
20170602_OSSummit_an_intelligent_storage20170602_OSSummit_an_intelligent_storage
20170602_OSSummit_an_intelligent_storage
 
Hybrid Transactional/Analytics Processing with Spark and IMDGs
Hybrid Transactional/Analytics Processing with Spark and IMDGsHybrid Transactional/Analytics Processing with Spark and IMDGs
Hybrid Transactional/Analytics Processing with Spark and IMDGs
 
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
 
Best Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache SparkBest Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache Spark
 
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...
Beyond the Query: A Cassandra + Solr + Spark Love Triangle Using Datastax Ent...
 

Dernier

(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 

Dernier (20)

(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 

Bogdan Kecman Advanced Databasing

  • 1. (R)DBMS Advanced techniques Bogdan Kecman MySQL Principal Technical Engineer @ORACLE bogdan.kecman@oracle.com bogdan.kecman@bad-team.net GrowIT, Novi Sad, December 2018.
  • 2. Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  • 3. 3 Follow the talk: https://joind.in/talk/c03bc
  • 5. 5 Total Cost of Operation
  • 6. Conventional setup 6 PRESENTATION LAYER CLIENTS MIDDLEWARE LAYER LOGIC INTEGRATION PLUGINS and ADAPTERS WRAPPERS EVENT SOURCES BUSINESS MODULES RESOURCE MGM MAGIC MONITORING DATA STORAGE ?
  • 7. MAGIC? • Education? • Information volume? • Information complexity? • Not sexy enough? • Money not good? • Requirement? Why is so little attention given to monitoring and data storage? 7
  • 8. How to uncover the MAGIC? ● Understand the problem ● Check out all available tools ● Think OUTSIDE THE BOX but KNOW THE BOX!!! Any sufficiently advanced technology is indistinguishable from magic! 8
  • 9. Problems? ● Availability & Reliability – robustness ● Scalability – “all directions” ● Performance ● TCO optimization For every expert, there is an equal and opposite expert! 9
  • 10. Know your tools Any sufficiently advanced technology is indistinguishable from magic! 10
  • 11. Examples – MySQL MySQL environment can be very complex or very simple! 11 MySQL Cluster Data Nodes InnoDB SE s1 SE s2MyISAM
  • 12. Examples – MySQL InnoDB ● SQL (via MySQL connector/php,java,ruby,python..., odbc, C-API..) ● MEMCACHED (via memcached plugin on the mysqld) ● InnoDB API (C-API) How can you access data stored in InnoDB table? 12
  • 13. Examples – MySQL HTTP plugin ● SQL over HTTP(s) – http(s)://host:port/sql/SELECT+%2A+FROM+t1+ORDER+BY+f1 ● CRUD (aka REST) over HTTP(s) – http(s)://host:port/crud/database/table/primaryKey ● JSON over HTTP(s) – http(s)://host:port/doc/database/table – http(s)://host:port/doc/database/table/key Other ways to access data? 13
  • 14. Results – MySQL InnoDB ● 70000 TPS vs 10000 TPS 14
  • 15. Examples – MySQL Cluster ● SQL (via MySQL connector/php,java,ruby..., odbc, MySQL C-API..) ● MEMCACHED (add ndbcluster driver to memcached server) ● ClusterJ, JPA, ClusterJPA, LDAP ● ndbAPI (C/C++ API) MySQL Cluster is a system that runs 80% of mobile traffic in the World! 15 ClusterJ MySQL JDBC Apps JPA JNI Python Ruby ClusterJPA Apps Apps Apps Apps Apps Node.js JSON Apps mod-ndb Apache Apps ndb-eng Memcached Apps Apps NDB API (C++) MySQL Cluster Data Nodes Apps PHP PERL Apps
  • 16. Examples – MySQL Cluster ● SQL (via MySQL C-API or JDBC..) to create and backup/restore schema (DDL) ● ClusterJ, LDAP to access and manipulate data (DML) MySQL Cluster how are Telco’s accessing it 16 Visitor Location Register Authentication Center Home Location Register NDB API (C++) MySQL Cluster Data Nodes Management Apps C API / JDBC ClusterJ JNIMySQL LDAP
  • 17. Examples – MySQL Cluster as persistent memcached Memcached is fast as very usable, can we get similar performance but keep data persistent ? 17 hash key to find data Memcache httpd memcached memcached memcached memcache key PHP/Perl friends:12389 MySQL Cluster Data Nodememcached Memcache Client Application MySQL Cluster Data Node NDB Engine Traditional Persistent with MCCGE
  • 18. Results - MySQL Cluster as persistent memcached memcachetest -t 2 -M 7000 -c 25000 18
  • 19. Results – MySQL Cluster SQL vs NDB API Reads / seconds – note logarithmic Y axis 19
  • 20. PostgreSQL Columnar Store ● Compression ● Column Projection ● Different / no Indexes Have Analytics Workload, running trough OLAP cubes 20
  • 21. PostgreSQL GPU Acceleration ● CUDA 7.0 or later ● Accelerates sequential scan, hash based table join and aggregate functions PG Strom 21
  • 22. Results – PostgreSQL Data courtesy of Nikola Krgović from Twin Star Systems 22 PSQL Columnar GPU GPU+Columnar test1 10.4 143.3 9.1 28.1 test2 45.6 41.5 36.1 41.2 test3 825 820 859 832
  • 23. Tokutek - TokuDB Storage Engine, TokuMX Fractals anyone? 23
  • 24. Server monitoring & profiling ● MySQL Enterprise Monitor ● MySQL SYS schema ● pgBadger ● pgFouine ● Nagios and Zabbix plugins to monitor (r)DBMS state I believe in having each device secured and monitoring each device, rather than just monitoring holistically on the network, and then responding in short enough time for damage control. 24
  • 25. DB Model optimization ● First Normal Form ● Second Normal Form ● Third Normal Form ● Boyce – Codd normal form ● Fourth Normal Form ● 5th , Domain Key and 6th Normal Form. In order to denormalize db model you first need to achieve it’s NF 25
  • 26. Query profiling and tuning / optimization ● ORM ● ORM? ● ORM REALLY? ● Profile queries! ● Choose a right (R)DBMS ● Use CTE (common table expressions) Do you really trust ORM to write a query for you? 26
  • 27. Example - Query profiling and tuning / optimization Original: DELETE FROM t1 WHERE id NOT IN (SELECT id FROM t1_data); Query time 3.5s - 5s Optimized to: DELETE t1 FROM t1 LEFT OUTER JOIN t1_data ON msg.id=msg_data.id WHERE t1_data.id IS NULL; Optimized query time below 1.5s! More then 3 times faster! Large number of entries inside IN() clause is not smart 27
  • 28. Example - Query profiling and tuning / optimization Do you really trust ORM to write a query for you? 28 Original query (ORM generated) takes 10 minutes to execute: SELECT t1.wid, t2.wname, Date(t1.t_stamp) AS 'dateOnly', t1.rpd + ( t1.runminpd / 60 ) AS 'PDRuntime', Min(t1.t_stamp), l.name, fg.fieldgroupname FROM arch.lfedata plc LEFT JOIN arch.lfe_wellsites w ON t1.wid = t2.id LEFT JOIN arch.lfe_locations l ON t2.locationid = l.id LEFT JOIN arch.lfe_fieldgroups fg ON l.fieldgroupid = fg.fieldgroupid
  • 29. Example - Query profiling and tuning / optimization Do you really trust ORM to write a query for you? 29 WHERE t1.t_stamp BETWEEN '2016-06-01 00:00:00' AND '2016-08-31 23:00:00' AND quality_code = 192 AND t2.compreport = 1 GROUP BY t1.wid, Date(t1.t_stamp) UNION (SELECT 2, 'NONE', '2000-00-00 00:00:00', 0, '2000-00-00 00:00:00', 'ZZ_NoName', 'NoFieldGroup' ORDER BY name, wname, dateonly DESC);
  • 30. Example - Query profiling and tuning / optimization Do you really trust ORM to write a query for you? 30 Final optimized query takes 10 seconds to execute: SELECT t.wid, t.wname, t. 'dateOnly', plc.rpd +(plc.RunMinPD/60) as 'PDRuntime', l.name, fg.FieldGroupName FROM (SELECT plc.wid, DATE(plc.t_stamp) as 'dateOnly', MIN(lfedata_ndx) as 'ndx', t2.wname, t2.locationId FROM arch.lfedata plc INNER JOIN arch.lfe_wellsites w ON plc.wid = t2.id WHERE plc.t_stamp BETWEEN '2016-06-01 00:00:00' AND '2016-08-31 23:55:00' AND plc.quality_code = 192 AND t2.compReport = 1 GROUP BY plc.wid, DATE(plc.t_stamp) ) t INNER JOIN arch.lfedata plc ON t.ndx = plc.lfedata_ndx LEFT JOIN arch.lfe_locations l ON t.locationId = l.id LEFT JOIN arch.lfe_fieldgroups fg ON l.fieldGroupId = fg.FieldGroupId;
  • 31. Sources ● Voxxed Days – Bogdan Kecman: https://youtu.be/u0A0i9OEohs ● mDevDay – Bogdan Kecman: https://youtu.be/0vnSchjQHoE ● Data Science – Nikola Krgović: https://youtu.be/MhE1skm0y7k ● MySQL Documentation: https://dev.mysql.com/doc/ ● PostgreSQL Documentation: https://www.postgresql.org/docs/ ● The one book to rule them all: https://www.amazon.com/dp/0321197844/ ● TokuDB Fractal Index WP: http://www.miniuri.com/306 The only source of knowledge is experience! 31
  • 32. HVALA! Bogdan Kecman MySQL Principal Technical Engineer bogdan.kecman@oracle.com bogdan.kecman@bad-team.net GrowIT, Novi Sad, December 2018.