SlideShare a Scribd company logo
1 of 51
JSON caveats
Oracle 12.1
Agenda
1. JSON in relational storage
2. RDMS Configuration
3. Storage
4. Ingestion
5. Retrieval
6. Search
7. Maintenance
8. Fast search
9. Summary
10. Q&A session
JSON in RDBMS
Why
• Consistency (integrity, transaction ACIDity) for storing JSON documents
• Denormalization of complex objects
What
• Logs with responses/requests received/sent during software interaction
• Configuration data, key/value user preferences
• Unstructured or semi-structured complex objects
and please forget about any analytics by JSON fields 
DB configuration
• Install JSON fixes on regular base
• Retain scripts to check old issues – new fixes restores them often
• These patches MUST be installed
1. Patch 20080249: JSON Patch Bundle 1
2. Patch 20885778: JSON Patch Bundle 2
3. Patch 24836374: JSON Patch Bundle 3
Oracle thinks JSON is stable now so no more dedicated JSON Bundle patches!
Fixes are inside ordinal database proactive bundle patches (Doc ID 1937782.1).
Table structure
UCS2
10000
Table structure
BLOB for JSON benefits:
• Twice less space consumption
• less I/O due less space
• No implicit character-set conversion if the database
character set is not AL32UTF8
RFC 4627
Table structure
Constraint works fine but JAVA still fails 
Table structure
Ingestion
• Oracle treats JSON as string – no tailored object type
• Insert works fine
• No option to update a piece of JSON
Ingestion
Ingestion
N, run
with json
strict
with json
lax
with json lax and unique
names without constraints
1 115 121 132 83
2 119 117 142 80
3 119 115 132 91
4 115 110 136 90
5 117 125 138 92
6 122 117 135 90
7 116 117 134 88
8 127 120 142 81
9 115 125 152 80
10 118 114 147 83
AVG 118,3 118,1 139 85,8
Ingestion
Ingestion
N, run
with json
strict with json lax
with json lax and unique
names
without
constraints with cache
1 115 121 132 83 78
2 119 117 142 80 78
3 119 115 132 91 84
4 115 110 136 90 75
5 117 125 138 92 78
6 122 117 135 90 75
7 116 117 134 88 75
8 127 120 142 81 78
9 115 125 152 80 77
10 118 114 147 83 77
AVG 118,3 118,1 139 85,8 77,5
Retrieval
• Extract 1 row with raw JSON data and pass it to application server as is
• Issue SQL statement which extracts 1 row from table and parses it via Oracle
JSON feature
• Create a view which encapsulates JSON treatment and extract a row from the view
Retrieval
Nothing changes
Retrieval
Bad approach – each json_value function parses JSON
again!
The same for .notation!
Retrieval
Storage logic could be encapsulated inside virtual columns
Retrieval
Retrieval
Retrieval
Retrieval
Retrieval
Views
1. Often become non mergable so performance degrades
2. If 2 or more json_table are used exception doesn’t occur but results could be
wrong in aggregate functions. no_merge hint helps sometimes.
3. ORA-600 and ORA-7445 No Data to be read from socket arise in arbitrary
places
4. Count(distinct <field>) fails with ORA-7445 No Data to be read from socket.
Could be fixed by removing group by, adding row_number() over (partition by
<group by fields>) rn and filtering out records where rn <> 1
Search
Search
Search
Separate indexes should be
created for .notation?
Search
Search
Query rewrite
Search
Use index side effect – create JSON validation
ORA-01722: invalid number
Validator 
Search
Multiple columns indexing
Search
Search
Search
Search
Search
. notation is not supported
again!
Search
= 0
2 different tokens
All Oracle text reserved words -
https://docs.oracle.com/database/121/CCREF/cqspcl.htm#CCREF2091
= 1
Search
Search
Search
filter
Anchor Inside one
object
Ingestion
= 0
= 1
Ingestion
= 0
= 1
Ingestion
Execution time: ~125 seconds
Ingestion
Execution time: ~7 seconds
Refresh job execution time: ~4 seconds
Ingestion
Execution time: ~8 seconds
Ingestion
= 0
= 0
= 0
= 0
= 1
TRANSACTIONAL doesn’t work for sections! Only for tokens!
Ingestion
Ingestion
Execution time: ~6 seconds
Maintenance
Pos/prefix columns with JSON data via _JSON like INVOICE_JSON before.
• Create daily checks
1. If you need control JSON format (strict/lax) use dba_tab_columns and
all_json_columns views to check JSON constrains
2. If you need insert performance check dba_lobs to check cache attribute
• Check CONTEXT indexes are in proper state
Maintenance
Provide regular indexes optimization
1. Collect fragmented indexes (estimated row fragmentation)
2. Collect indexes with many deleted rows (estimated garbage size)
3. Run ctx_ddl.optimize_index in FULL mode (SERIAL or PARALLEL)
Conclusion
• JSON is always tradeoff between performance/data treatment convenience/integrity
• Indexing strategy should be checked very careful you use 2 notations especially
• JSON treatment is acceptable in row-per-row scenario
• JSON features are still non-stable
• Oracle fails with JSON more 2 Mb very often
• Current implementation doesn’t look like “document-stored” DB
• Tailored search solutions bring better performance
and we are waiting Oracle 12.2 
Q&A
THANK YOU.
WE ARE HIRING!
Alexander Tokarev
Senior Developer

More Related Content

What's hot

Oracle High Availabiltity for application developers
Oracle High Availabiltity for application developersOracle High Availabiltity for application developers
Oracle High Availabiltity for application developersAlexander Tokarev
 
Scaling MySQL Strategies for Developers
Scaling MySQL Strategies for DevelopersScaling MySQL Strategies for Developers
Scaling MySQL Strategies for DevelopersJonathan Levin
 
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Dave Stokes
 
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDave Stokes
 
MySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationMySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationDave Stokes
 
Migration from mysql to elasticsearch
Migration from mysql to elasticsearchMigration from mysql to elasticsearch
Migration from mysql to elasticsearchRyosuke Nakamura
 
Confoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsConfoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsDave Stokes
 
Introduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerIntroduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerMydbops
 
cPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturescPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturesDave Stokes
 
MySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesMySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesDave Stokes
 
PostgreSQL Advanced Queries
PostgreSQL Advanced QueriesPostgreSQL Advanced Queries
PostgreSQL Advanced QueriesNur Hidayat
 
Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Dave Stokes
 
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...Dave Stokes
 
MySQL Indexing : Improving Query Performance Using Index (Covering Index)
MySQL Indexing : Improving Query Performance Using Index (Covering Index)MySQL Indexing : Improving Query Performance Using Index (Covering Index)
MySQL Indexing : Improving Query Performance Using Index (Covering Index)Hemant Kumar Singh
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsDave Stokes
 
Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational databaseDave Stokes
 
Introduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sIntroduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sSveta Smirnova
 
Oracle 12.2 sharding learning more
Oracle 12.2 sharding learning moreOracle 12.2 sharding learning more
Oracle 12.2 sharding learning moreLeyi (Kamus) Zhang
 
MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MYXPLAIN
 

What's hot (20)

Oracle High Availabiltity for application developers
Oracle High Availabiltity for application developersOracle High Availabiltity for application developers
Oracle High Availabiltity for application developers
 
Sql killedserver
Sql killedserverSql killedserver
Sql killedserver
 
Scaling MySQL Strategies for Developers
Scaling MySQL Strategies for DevelopersScaling MySQL Strategies for Developers
Scaling MySQL Strategies for Developers
 
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
Longhorn PHP - MySQL Indexes, Histograms, Locking Options, and Other Ways to ...
 
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and HistogramsDutch PHP Conference 2021 - MySQL Indexes and Histograms
Dutch PHP Conference 2021 - MySQL Indexes and Histograms
 
MySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentationMySQL Replication Update - DEbconf 2020 presentation
MySQL Replication Update - DEbconf 2020 presentation
 
Migration from mysql to elasticsearch
Migration from mysql to elasticsearchMigration from mysql to elasticsearch
Migration from mysql to elasticsearch
 
Confoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & HistogramsConfoo 2021 - MySQL Indexes & Histograms
Confoo 2021 - MySQL Indexes & Histograms
 
Introduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerIntroduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizer
 
cPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturescPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven Features
 
MySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesMySQL 8.0 Operational Changes
MySQL 8.0 Operational Changes
 
PostgreSQL Advanced Queries
PostgreSQL Advanced QueriesPostgreSQL Advanced Queries
PostgreSQL Advanced Queries
 
Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my!
 
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
 
MySQL Indexing : Improving Query Performance Using Index (Covering Index)
MySQL Indexing : Improving Query Performance Using Index (Covering Index)MySQL Indexing : Improving Query Performance Using Index (Covering Index)
MySQL Indexing : Improving Query Performance Using Index (Covering Index)
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query Optimizations
 
Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational database
 
Introduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]sIntroduction into MySQL Query Tuning for Dev[Op]s
Introduction into MySQL Query Tuning for Dev[Op]s
 
Oracle 12.2 sharding learning more
Oracle 12.2 sharding learning moreOracle 12.2 sharding learning more
Oracle 12.2 sharding learning more
 
MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6
 

Similar to Oracle json caveats

Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"Fwdays
 
Electron, databases, and RxDB
Electron, databases, and RxDBElectron, databases, and RxDB
Electron, databases, and RxDBBen Gotow
 
Real time indexes in Sphinx, Yaroslav Vorozhko
Real time indexes in Sphinx, Yaroslav VorozhkoReal time indexes in Sphinx, Yaroslav Vorozhko
Real time indexes in Sphinx, Yaroslav VorozhkoFuenteovejuna
 
Scaling an invoicing SaaS from zero to over 350k customers
Scaling an invoicing SaaS from zero to over 350k customersScaling an invoicing SaaS from zero to over 350k customers
Scaling an invoicing SaaS from zero to over 350k customersSpeck&Tech
 
2008 2086 Gangler
2008 2086 Gangler2008 2086 Gangler
2008 2086 GanglerSecure-24
 
MySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellMySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellEmily Ikuta
 
Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Ryan Cuprak
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQLSatoshi Nagayasu
 
Extreme Availability using Oracle 12c Features: Your very last system shutdown?
Extreme Availability using Oracle 12c Features: Your very last system shutdown?Extreme Availability using Oracle 12c Features: Your very last system shutdown?
Extreme Availability using Oracle 12c Features: Your very last system shutdown?Toronto-Oracle-Users-Group
 
MySQL Cluster 7.3 Performance Tuning - Severalnines Slides
MySQL Cluster 7.3 Performance Tuning - Severalnines SlidesMySQL Cluster 7.3 Performance Tuning - Severalnines Slides
MySQL Cluster 7.3 Performance Tuning - Severalnines SlidesSeveralnines
 
Building a Large Scale SEO/SEM Application with Apache Solr
Building a Large Scale SEO/SEM Application with Apache SolrBuilding a Large Scale SEO/SEM Application with Apache Solr
Building a Large Scale SEO/SEM Application with Apache SolrRahul Jain
 
MySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics ImprovementsMySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics ImprovementsMorgan Tocker
 
Sql server engine cpu cache as the new ram
Sql server engine cpu cache as the new ramSql server engine cpu cache as the new ram
Sql server engine cpu cache as the new ramChris Adkin
 
OOW09 EBS Tech Essentials
OOW09 EBS Tech EssentialsOOW09 EBS Tech Essentials
OOW09 EBS Tech Essentialsjucaab
 
从 Oracle 合并到 my sql npr 实例分析
从 Oracle 合并到 my sql   npr 实例分析从 Oracle 合并到 my sql   npr 实例分析
从 Oracle 合并到 my sql npr 实例分析YUCHENG HU
 
261197832 8-performance-tuning-part i
261197832 8-performance-tuning-part i261197832 8-performance-tuning-part i
261197832 8-performance-tuning-part iNaviSoft
 

Similar to Oracle json caveats (20)

Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
 
Electron, databases, and RxDB
Electron, databases, and RxDBElectron, databases, and RxDB
Electron, databases, and RxDB
 
Ashawr perf kscope
Ashawr perf kscopeAshawr perf kscope
Ashawr perf kscope
 
Real time indexes in Sphinx, Yaroslav Vorozhko
Real time indexes in Sphinx, Yaroslav VorozhkoReal time indexes in Sphinx, Yaroslav Vorozhko
Real time indexes in Sphinx, Yaroslav Vorozhko
 
Scaling an invoicing SaaS from zero to over 350k customers
Scaling an invoicing SaaS from zero to over 350k customersScaling an invoicing SaaS from zero to over 350k customers
Scaling an invoicing SaaS from zero to over 350k customers
 
2008 2086 Gangler
2008 2086 Gangler2008 2086 Gangler
2008 2086 Gangler
 
MySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellMySQL 5.7 in a Nutshell
MySQL 5.7 in a Nutshell
 
Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL
 
JavaOne_2010
JavaOne_2010JavaOne_2010
JavaOne_2010
 
Extreme Availability using Oracle 12c Features: Your very last system shutdown?
Extreme Availability using Oracle 12c Features: Your very last system shutdown?Extreme Availability using Oracle 12c Features: Your very last system shutdown?
Extreme Availability using Oracle 12c Features: Your very last system shutdown?
 
MySQL Cluster 7.3 Performance Tuning - Severalnines Slides
MySQL Cluster 7.3 Performance Tuning - Severalnines SlidesMySQL Cluster 7.3 Performance Tuning - Severalnines Slides
MySQL Cluster 7.3 Performance Tuning - Severalnines Slides
 
Building a Large Scale SEO/SEM Application with Apache Solr
Building a Large Scale SEO/SEM Application with Apache SolrBuilding a Large Scale SEO/SEM Application with Apache Solr
Building a Large Scale SEO/SEM Application with Apache Solr
 
MySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics ImprovementsMySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics Improvements
 
Sql server engine cpu cache as the new ram
Sql server engine cpu cache as the new ramSql server engine cpu cache as the new ram
Sql server engine cpu cache as the new ram
 
Redshift overview
Redshift overviewRedshift overview
Redshift overview
 
OOW09 EBS Tech Essentials
OOW09 EBS Tech EssentialsOOW09 EBS Tech Essentials
OOW09 EBS Tech Essentials
 
从 Oracle 合并到 my sql npr 实例分析
从 Oracle 合并到 my sql   npr 实例分析从 Oracle 合并到 my sql   npr 实例分析
从 Oracle 合并到 my sql npr 实例分析
 
261197832 8-performance-tuning-part i
261197832 8-performance-tuning-part i261197832 8-performance-tuning-part i
261197832 8-performance-tuning-part i
 
Oracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node finalOracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node final
 

More from Alexander Tokarev

Open Policy Agent for governance as a code
Open Policy Agent for governance as a code Open Policy Agent for governance as a code
Open Policy Agent for governance as a code Alexander Tokarev
 
Relational databases for BigData
Relational databases for BigDataRelational databases for BigData
Relational databases for BigDataAlexander Tokarev
 
Inmemory BI based on opensource stack
Inmemory BI based on opensource stackInmemory BI based on opensource stack
Inmemory BI based on opensource stackAlexander Tokarev
 
Oracle InMemory hardcore edition
Oracle InMemory hardcore editionOracle InMemory hardcore edition
Oracle InMemory hardcore editionAlexander Tokarev
 
Tagging search solution design Advanced edition
Tagging search solution design Advanced editionTagging search solution design Advanced edition
Tagging search solution design Advanced editionAlexander Tokarev
 
Faceted search with Oracle InMemory option
Faceted search with Oracle InMemory optionFaceted search with Oracle InMemory option
Faceted search with Oracle InMemory optionAlexander Tokarev
 
Tagging search solution design
Tagging search solution designTagging search solution design
Tagging search solution designAlexander Tokarev
 
Data structures for cloud tag storage
Data structures for cloud tag storageData structures for cloud tag storage
Data structures for cloud tag storageAlexander Tokarev
 

More from Alexander Tokarev (15)

Rate limits and all about
Rate limits and all aboutRate limits and all about
Rate limits and all about
 
rnd teams.pptx
rnd teams.pptxrnd teams.pptx
rnd teams.pptx
 
FinOps for private cloud
FinOps for private cloudFinOps for private cloud
FinOps for private cloud
 
Graph ql and enterprise
Graph ql and enterpriseGraph ql and enterprise
Graph ql and enterprise
 
FinOps introduction
FinOps introductionFinOps introduction
FinOps introduction
 
Open Policy Agent for governance as a code
Open Policy Agent for governance as a code Open Policy Agent for governance as a code
Open Policy Agent for governance as a code
 
Relational databases for BigData
Relational databases for BigDataRelational databases for BigData
Relational databases for BigData
 
Cloud DWH deep dive
Cloud DWH deep diveCloud DWH deep dive
Cloud DWH deep dive
 
Cloud dwh
Cloud dwhCloud dwh
Cloud dwh
 
Inmemory BI based on opensource stack
Inmemory BI based on opensource stackInmemory BI based on opensource stack
Inmemory BI based on opensource stack
 
Oracle InMemory hardcore edition
Oracle InMemory hardcore editionOracle InMemory hardcore edition
Oracle InMemory hardcore edition
 
Tagging search solution design Advanced edition
Tagging search solution design Advanced editionTagging search solution design Advanced edition
Tagging search solution design Advanced edition
 
Faceted search with Oracle InMemory option
Faceted search with Oracle InMemory optionFaceted search with Oracle InMemory option
Faceted search with Oracle InMemory option
 
Tagging search solution design
Tagging search solution designTagging search solution design
Tagging search solution design
 
Data structures for cloud tag storage
Data structures for cloud tag storageData structures for cloud tag storage
Data structures for cloud tag storage
 

Recently uploaded

Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 

Recently uploaded (20)

Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 

Oracle json caveats

Editor's Notes

  1. One of our projects uses JSON extensively so we have a lot of stuff to share with you . We found quite a few JSON caveats you whether may or not face with in Oracle 12.1. We will cover the best part of issues you could face with starting from a decision to use JSON in Oracle to daily maintenance and will try to advice how to process JSON efficiently. Please pay attention some advices will be useless in Oracle 12.2 especially related to search.
  2. We will try to go through full JSON field lifecycle. Please pay attention some of principles being mentioned will not be connected to JSON but without them good DB performance will be impossible. I divided retrieval and search which look similar but the difference will be clear further. Sometimes we will return to plan point because of additional workarounds.
  3. Let’s discuss what for do we need JSON in RDBMS These objects is something like tags, questionnaires, documents with many levels of nesting which requires huge number of relational tables. Key idea – avoid extra joins.
  4. Please don’t forget about Support – check latest JSON fixes. Without installed patches there a tons of errors: ora-600, no read data from the socket, 2 json_tables don’t work in different session, FORMAT JSON should be mentioned in case of BLOB fields.
  5. Let’s decide how we would like to store our JSON. Which table is better? DB encoding is Oracle-recommended AL32UTF8 Let’s add 10000 records in each table and check space consumption. Universal Coded Character Set - ucs
  6. So final structure recommended by Oracle is
  7. We created a table with BLOB, put but JAVA side failed with number conversion. Let’s add is json constraint to ensure no wrong data in our table.
  8. Let’s check in any online JSON validator Why Oracle passes invalid JSON? Is it actually invalid? 50/50 Oracle default is Lax. If you need to be completely sure for any JSON parser use STRICT.
  9. If we use . Notation it fails so have to rewrite all json which leads to huge I/O in case of JSON + sophisticated PL/SQL processing in case of JSON more 4000 bytes. If we need update JSON we create small Java utilities which run in our CI tool. It works faster that sql/plsql in Java bulk processing especially.
  10. We created perfect looking json table structure and started to ingest our data. Let’s measure just time, without context switches and e.t.c. otherwise we have no time to check all stuff during the presentation. We will use rather simple script. It is slow and let’s omit BULK. Even if we add it the performance is low. At least I state it is low. What the reason? How to defeat it? Let’s remove our constraints we just created to see which one contributes more
  11. We have decent speed but it is still an issue. Is it possible to get more? Any ideas? Without bulk, pure sql and obvious stuff?
  12. Let me give you a glue What Oracle documentation says about it?
  13. So ingestion is twice faster with CACHE and without constraints Frankly speaking we don’t switch off constraint but having known our data we use CACHE for best part of our BLOB intended for JSON. I hope you all have tests of your database structure so add something like it there and discuss with your developers why they didn’t set cache for the particular BLOB
  14. Retrieval – extract information from JSON There are many options. The first way is common way before Oracle 12 and it works fine. Let’s consider others 2.
  15. The simplest option – use . Notation. Let’s check. Doesn’t work. Let’s add an alias. Doesn’t work as well. Let’s add a check and it works now
  16. Let’s try to work with json_value and complex structures .notation doesn’t work with arrays in Oracle 12.1 but does work in Oracle 12.2
  17. JSON table looks very promising. Single parsing, a little verbose syntax, arrays work perfect so sounds cool! Isn’t it?
  18. Let’s have a look into other example which seems very straighforward We have 2 json_table which takes a lot of effort from CPU We got the result but what’s the price – 2 parse and unreadable sql!
  19. Let’s make it simpler – json_table works for the same line so could be used in a such manner We have 2 json_table which takes a lot of effort from CPU
  20. So it is the proper way and 1 sql call
  21. It is rather hard to show issues with view without showing production data but we collected all issues
  22. For sure if there is no index we have full scans which is bad actually. Let’s create the index. Plan is the same. The reason is filter condition
  23. So we have to create indexes completely equal to filter conditions and we have them in the plan
  24. Let’s check .notation – we should ensure the index is used so we see that it is done internally via JSON_QUERY rather than JSON value so we need to create separate set of indexes.
  25. Let’s do it Let’s run and see what we get. What do you think? Exception!!! Once we add the alias the index works fine I hope you knows how these indexes work inside – they are virtual columns where extended statistic is gather but it is another story
  26. Nevertheless it is possible to have only 1 index. Once we have it we could use . notation but we make json field more rigid.
  27. Creating indexes we could maintain sort of json schema
  28. There are 2 options for multiple column indexing. The straightforward and not. Queries are a little bit ugly
  29. Let’s try more appropriate way. As we seen for indexes they work using virtual columns. Let’s use the same approach. Once we add columns index them as the ordinal ones.
  30. Let’s start the latest case. Which index will be used? What should we do? Let’s move to the next slide.
  31. Let’s create an index without dropping others indexes and check all our queries.
  32. Even json table as well as others statements and multi-column queries work properly.
  33. It sounds very good to be in our slides but for sure there are caveats.
  34. How many rows do you expect to see? Let’s have a look into the plan. The plan has CONTAIN which is Oracle Text operator and _ is a placeholder. Moreover _ is a letter delimiter in default lexert that’s why the second query returns 2 row. There is 2 tokens in reverted index. So we should instruct Oracle text to search by whole phrase. The behavior changes from patch to patch. So Oracle full text indexes are rather tricky. There are quite a few of nuances like bitmap index conversion, filter by indexes but it is out of current scope.
  35. Let’s play with indexes and json where there is a lot of nested elements. We need to find value = ‘640’ in class type ‘Country’. Please pay attention we have 2 of them.
  36. Let’s try to find data by equal queries. All of them return 2 records which looks like or. Oracle textcontains deals with tokens as we know so if it finds a token in a document it is happy. There is no way to fix a a JSON object boundaries. Let’s try to use JSON table. It works. But could we make the search faster?
  37. And we have a good plan which limits by tokens and next filter by expression. Moreover we don’t waste time for JSON_TABLE so it is faster from I/O and CPU prospectives
  38. Let’s check how data ingestion works with FTS indexes Let’s add a new record. How many record will we see? Zero! Why? JSON indexes are fts so need be refreshed separately. Once we did it we see a record.
  39. How to address the issue? Let’s have a look into the dictionary. Let’s fix it. We need to issue replace_metadata mentioning REPLACE METADATA once again. Let’s repeat the query and will see new sync type. I deleted the record with ID 8888888 and repeated insert from previous page. How many records do we get? So the conclusion is if you need to use context indexes after you inserted data you need something else but we discuss it further.
  40. Let’s check the performance and run our well know script with intermediary commit. Execution time is huge comparing first execution (about 2 seconds) with json strict and unique identifiers. So the question: which command takes the best part of time if we have a look into database logs? No, it will be other which is invoked before each commit implicitly.
  41. Let’s defer index update without inventing a wheel like hand-made job procedures. If we have a look in details it is done by job but the profit is when you drop the index it will be dropped automatically + refresh metadata are in the index itself. One place. So we run the script, it works slowly but definitely better even in conjunction with refresh time.
  42. But what to do if we need an access indexed data transactionaly? Oracle does provide something for it. Let’s test. In order to do it drop the index and don’t forget FORCE option otherwise Oracle fails and could live orphan CTXSYS dictionary records. So let’s check how TRANSACTIONAL works. It takes information from Oracle Text staging tables before they come in the reverted index actually but it slow the queries down for sure. Usualy they work 2 times slower when decent volume of data is out of sync. It is instruction how to process CONTAINTS rather than SYNC. We still need it. Please pay attention – there is no COMMIT inside.
  43. Let’s ensure we get our records via full text search commands without committing them. Let’s commit records. Nothing helps. But Oracle can’t lie. The conclusion – if you need transactional data access for json data you should invent something by yourself.
  44. Transactional option doesn’t work but we would like to have faster insert. Oracle 12 has new feature which works in terms of internals like TRANSACTIONAL i.e. deals with staging tables but with the new ones. In terms of update of the reverted index it works in async mode. It is name STAGE_ITAB. Let’s have a look in details. The first command instructs Oracle a new temporary table should be created with $G prefix equal to inverted index. The next assigns the storage to the new index and creates a job which moves data to the index. What is interesting the job is without a schedule – is invoked taking into account the DB workload. 3rd states data from staging should be moved to reverted index in async mode. Let’s have a look into the dictionary
  45. Let’s check how it works using our famous statement. It sounds good regarding we could query after commit without additional sync. For sure we still out of transaction context but still…
  46. Context indexes become fragmented. Why? Unfortunately we have no time discussing it but we should have them less fragmented to provide fast search. Serial optimization makes indexes less fragmented but parallel is faster
  47. For sure it is our experience but inside DataArt we will use these guidelines further You already seen that proper json reinforced by constraints works slow but without constraints .notation doesn’t work for instance. The safest JSON treatment – extract one row, use json features as json_table, json_exist and etc Oracle json isn’t’ still stable even all patches are installed. ---- We try to use Solr or Elastic even if we have delays. Search speed SLA is more strict that SLA to see fresh data
  48. I would like to tell thank you for you time and questions once again. We are going to tell about JSON during DataArt IT talk series so follow us in VK/Facebook and welcome to our team.