SlideShare a Scribd company logo
1 of 31
Download to read offline
Advanced Databasing
Bogdan Kecman
MySQL Principal Technical Engineer @ORACLE
CEO, BAD-TEAM
bogdan.kecman@oracle.com
bogdan.kecman@bad-team.net
INIT, Banja Luka, Novembar 2019
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
Speed!!! Availability?!? Reliability?!? Scalability?!
4
Total Cost of Operation
Conventional setup
5
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?
6
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!
7
Problems?
●
Availability & Reliability – robustness
●
Scalability – “all directions”
●
Performance
●
TCO optimization
For every expert, there is an equal and opposite expert!
8
Know your tools
Any sufficiently advanced technology is indistinguishable from magic!
9
Examples – MySQL
MySQL environment can be very complex or very simple!
10
MySQL Cluster Data Nodes InnoDB SE s1 SE s2
MyISAM
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?
11
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?
12
Results – MySQL InnoDB
●
70000 TPS vs 10000 TPS
13
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!
14
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
15
Visitor Location Register
Authentication Center
Home Location Register
NDB API (C++)
MySQL Cluster Data Nodes
Management
Apps
C API / JDBC ClusterJ
JNI
MySQL LDAP
Examples – MySQL Cluster as persistent memcached
Memcached is fast as very usable, can we get similar performance but keep
data persistent ?
16
hash key
to find data
Memcache
httpd memcached
memcached
memcached
memcache key
PHP/Perl
friends:12389
MySQL
Cluster
Data Node
memcached
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
17
Results – MySQL Cluster SQL vs NDB API
Reads / seconds – note logarithmic Y axis
18
PostgreSQL Columnar Store
●
Compression
●
Column Projection
●
Different / no Indexes
Have Analytics Workload, running trough OLAP cubes
19
PostgreSQL GPU Acceleration
●
CUDA 7.0 or later
●
Accelerates sequential scan, hash based table join and aggregate
functions
PG Strom
20
Results – PostgreSQL
Data courtesy of Nikola Krgović from Twin Star Systems
21
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
test1 test2 test3
0
100
200
300
400
500
600
700
800
900
PSQL
Columnar
GPU
GPU+Columnar
Tokutek - TokuDB Storage Engine, TokuMX
Fractals anyone?
22
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.
23
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
24
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?
25
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
26
Example - Query profiling and tuning / optimization
Do you really trust ORM to write a query for you?
27
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?
28
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?
29
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!
30
HVALA!
Bogdan Kecman
MySQL Principal Technical Engineer
bogdan.kecman@oracle.com
bogdan.kecman@bad-team.net
, Banja Luka, Novembar 2019.

More Related Content

Similar to Bogdan Kecman INIT Presentation

20170602_OSSummit_an_intelligent_storage
20170602_OSSummit_an_intelligent_storage20170602_OSSummit_an_intelligent_storage
20170602_OSSummit_an_intelligent_storageKohei KaiGai
 
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
 
Tales from the Field
Tales from the FieldTales from the Field
Tales from the FieldMongoDB
 
Thinking DevOps in the Era of the Cloud - Demi Ben-Ari
Thinking DevOps in the Era of the Cloud - Demi Ben-AriThinking DevOps in the Era of the Cloud - Demi Ben-Ari
Thinking DevOps in the Era of the Cloud - Demi Ben-AriDemi Ben-Ari
 
MySQL 5.7. Tutorial - Dutch PHP Conference 2015
MySQL 5.7. Tutorial - Dutch PHP Conference 2015MySQL 5.7. Tutorial - Dutch PHP Conference 2015
MySQL 5.7. Tutorial - Dutch PHP Conference 2015Dave Stokes
 
MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015Dave Stokes
 
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.
 
The 2nd half. Scaling to the next^2
The 2nd half. Scaling to the next^2The 2nd half. Scaling to the next^2
The 2nd half. Scaling to the next^2Haggai Philip Zagury
 
Scylla Summit 2018: The Short and Straight Road That Leads from Cassandra to ...
Scylla Summit 2018: The Short and Straight Road That Leads from Cassandra to ...Scylla Summit 2018: The Short and Straight Road That Leads from Cassandra to ...
Scylla Summit 2018: The Short and Straight Road That Leads from Cassandra to ...ScyllaDB
 
MongoDB Sharding Webinar 2014
MongoDB Sharding Webinar 2014MongoDB Sharding Webinar 2014
MongoDB Sharding Webinar 2014Dylan Tong
 
Performance tuning ColumnStore
Performance tuning ColumnStorePerformance tuning ColumnStore
Performance tuning ColumnStoreMariaDB plc
 
Data Science Connect, July 22nd 2014 @IBM Innovation Center Zurich
Data Science Connect, July 22nd 2014 @IBM Innovation Center ZurichData Science Connect, July 22nd 2014 @IBM Innovation Center Zurich
Data Science Connect, July 22nd 2014 @IBM Innovation Center ZurichRomeo Kienzler
 
PL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database AnalyticsPL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database AnalyticsKohei KaiGai
 
MariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance OptimizationMariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance OptimizationMariaDB plc
 
20201006_PGconf_Online_Large_Data_Processing
20201006_PGconf_Online_Large_Data_Processing20201006_PGconf_Online_Large_Data_Processing
20201006_PGconf_Online_Large_Data_ProcessingKohei KaiGai
 
Real World Performance - Data Warehouses
Real World Performance - Data WarehousesReal World Performance - Data Warehouses
Real World Performance - Data WarehousesConnor McDonald
 
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...arnaudsoullie
 
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...DataStax
 
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
 

Similar to Bogdan Kecman INIT Presentation (20)

20170602_OSSummit_an_intelligent_storage
20170602_OSSummit_an_intelligent_storage20170602_OSSummit_an_intelligent_storage
20170602_OSSummit_an_intelligent_storage
 
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
 
Tales from the Field
Tales from the FieldTales from the Field
Tales from the Field
 
Thinking DevOps in the Era of the Cloud - Demi Ben-Ari
Thinking DevOps in the Era of the Cloud - Demi Ben-AriThinking DevOps in the Era of the Cloud - Demi Ben-Ari
Thinking DevOps in the Era of the Cloud - Demi Ben-Ari
 
MySQL 5.7. Tutorial - Dutch PHP Conference 2015
MySQL 5.7. Tutorial - Dutch PHP Conference 2015MySQL 5.7. Tutorial - Dutch PHP Conference 2015
MySQL 5.7. Tutorial - Dutch PHP Conference 2015
 
MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015
 
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
 
The 2nd half. Scaling to the next^2
The 2nd half. Scaling to the next^2The 2nd half. Scaling to the next^2
The 2nd half. Scaling to the next^2
 
Scylla Summit 2018: The Short and Straight Road That Leads from Cassandra to ...
Scylla Summit 2018: The Short and Straight Road That Leads from Cassandra to ...Scylla Summit 2018: The Short and Straight Road That Leads from Cassandra to ...
Scylla Summit 2018: The Short and Straight Road That Leads from Cassandra to ...
 
MongoDB Sharding Webinar 2014
MongoDB Sharding Webinar 2014MongoDB Sharding Webinar 2014
MongoDB Sharding Webinar 2014
 
Performance tuning ColumnStore
Performance tuning ColumnStorePerformance tuning ColumnStore
Performance tuning ColumnStore
 
Data Science Connect, July 22nd 2014 @IBM Innovation Center Zurich
Data Science Connect, July 22nd 2014 @IBM Innovation Center ZurichData Science Connect, July 22nd 2014 @IBM Innovation Center Zurich
Data Science Connect, July 22nd 2014 @IBM Innovation Center Zurich
 
PL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database AnalyticsPL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
 
MariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance OptimizationMariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance Optimization
 
20201006_PGconf_Online_Large_Data_Processing
20201006_PGconf_Online_Large_Data_Processing20201006_PGconf_Online_Large_Data_Processing
20201006_PGconf_Online_Large_Data_Processing
 
Real World Performance - Data Warehouses
Real World Performance - Data WarehousesReal World Performance - Data Warehouses
Real World Performance - Data Warehouses
 
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
 
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
 
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?
 

Recently uploaded

AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxabhijeetpadhi001
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 

Recently uploaded (20)

AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 

Bogdan Kecman INIT Presentation

  • 1. Advanced Databasing Bogdan Kecman MySQL Principal Technical Engineer @ORACLE CEO, BAD-TEAM bogdan.kecman@oracle.com bogdan.kecman@bad-team.net INIT, Banja Luka, Novembar 2019
  • 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
  • 4. 4 Total Cost of Operation
  • 5. Conventional setup 5 PRESENTATION LAYER CLIENTS MIDDLEWARE LAYER LOGIC INTEGRATION PLUGINS and ADAPTERS WRAPPERS EVENT SOURCES BUSINESS MODULES RESOURCE MGM MAGIC MONITORING DATA STORAGE ?
  • 6. MAGIC? • Education? • Information volume? • Information complexity? • Not sexy enough? • Money not good? • Requirement? Why is so little attention given to monitoring and data storage? 6
  • 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! 7
  • 8. Problems? ● Availability & Reliability – robustness ● Scalability – “all directions” ● Performance ● TCO optimization For every expert, there is an equal and opposite expert! 8
  • 9. Know your tools Any sufficiently advanced technology is indistinguishable from magic! 9
  • 10. Examples – MySQL MySQL environment can be very complex or very simple! 10 MySQL Cluster Data Nodes InnoDB SE s1 SE s2 MyISAM
  • 11. 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? 11
  • 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? 12
  • 13. Results – MySQL InnoDB ● 70000 TPS vs 10000 TPS 13
  • 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! 14 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
  • 15. 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 15 Visitor Location Register Authentication Center Home Location Register NDB API (C++) MySQL Cluster Data Nodes Management Apps C API / JDBC ClusterJ JNI MySQL LDAP
  • 16. Examples – MySQL Cluster as persistent memcached Memcached is fast as very usable, can we get similar performance but keep data persistent ? 16 hash key to find data Memcache httpd memcached memcached memcached memcache key PHP/Perl friends:12389 MySQL Cluster Data Node memcached Memcache Client Application MySQL Cluster Data Node NDB Engine Traditional Persistent with MCCGE
  • 17. Results - MySQL Cluster as persistent memcached memcachetest -t 2 -M 7000 -c 25000 17
  • 18. Results – MySQL Cluster SQL vs NDB API Reads / seconds – note logarithmic Y axis 18
  • 19. PostgreSQL Columnar Store ● Compression ● Column Projection ● Different / no Indexes Have Analytics Workload, running trough OLAP cubes 19
  • 20. PostgreSQL GPU Acceleration ● CUDA 7.0 or later ● Accelerates sequential scan, hash based table join and aggregate functions PG Strom 20
  • 21. Results – PostgreSQL Data courtesy of Nikola Krgović from Twin Star Systems 21 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 test1 test2 test3 0 100 200 300 400 500 600 700 800 900 PSQL Columnar GPU GPU+Columnar
  • 22. Tokutek - TokuDB Storage Engine, TokuMX Fractals anyone? 22
  • 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. 23
  • 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 24
  • 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? 25
  • 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 26
  • 27. Example - Query profiling and tuning / optimization Do you really trust ORM to write a query for you? 27 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
  • 28. Example - Query profiling and tuning / optimization Do you really trust ORM to write a query for you? 28 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);
  • 29. Example - Query profiling and tuning / optimization Do you really trust ORM to write a query for you? 29 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;
  • 30. 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! 30
  • 31. HVALA! Bogdan Kecman MySQL Principal Technical Engineer bogdan.kecman@oracle.com bogdan.kecman@bad-team.net , Banja Luka, Novembar 2019.