This document discusses indexing and querying JSONB data in PostgreSQL. It introduces VODKA, a prototype for a JSONB query language called Jsquery. Jsquery supports complex queries over JSONB arrays and indexing. Examples show Jsquery outperforming traditional JSONB operators for array queries, with query plans utilizing GIN indexes on path and value extraction functions. Overall PostgreSQL with JSONB and Jsquery is shown to outperform MongoDB for the sample data, providing millisecond query times versus seconds for MongoDB.
R is a language and environment for statistical computing and graphics. R is free, this slide is for beginner. start from the basic first. variables, data structure, reading data, chart, function, conditional statement, iteration, grouping, reshape, string operations.
Patterns for slick database applicationsSkills Matter
Slick is Typesafe's open source database access library for Scala. It features a collection-style API, compact syntax, type-safe, compositional queries and explicit execution control. Community feedback helped us to identify common problems developers are facing when writing Slick applications. This talk suggests particular solutions to these problems. We will be looking at reducing boiler-plate, re-using code between queries, efficiently modeling object references and more.
Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matt...NoSQLmatters
PostgreSQL is well known being an object-relational database management system. In it`s core PostgreSQL is schema-aware dealing with fixed database tables and column types. However, recent versions of PostgreSQL made it possible to deal with schema-free data. Learn which new features PostgreSQL supports and how to use those features in your application.
R is a language and environment for statistical computing and graphics. R is free, this slide is for beginner. start from the basic first. variables, data structure, reading data, chart, function, conditional statement, iteration, grouping, reshape, string operations.
Patterns for slick database applicationsSkills Matter
Slick is Typesafe's open source database access library for Scala. It features a collection-style API, compact syntax, type-safe, compositional queries and explicit execution control. Community feedback helped us to identify common problems developers are facing when writing Slick applications. This talk suggests particular solutions to these problems. We will be looking at reducing boiler-plate, re-using code between queries, efficiently modeling object references and more.
Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matt...NoSQLmatters
PostgreSQL is well known being an object-relational database management system. In it`s core PostgreSQL is schema-aware dealing with fixed database tables and column types. However, recent versions of PostgreSQL made it possible to deal with schema-free data. Learn which new features PostgreSQL supports and how to use those features in your application.
Overview of the new JSON processing functionality in MySQL: the new JSON type, the in-line JSON path expressions, the JSON functions and how to go about indexing JSON
Slick: Bringing Scala’s Powerful Features to Your Database Access Rebecca Grenier
This talk will teach you how to use Slick in practice, based on our experience at EatingWell Media Group. Slick is a totally different (and better!) relational database mapping tool that brings Scala’s powerful features to your database interactions, namely: static-checking, compile-time safety, and compositionality.
Here at EatingWell, we have learned quite a bit about Slick over the past two years as we transitioned from a PHP website to Scala. I will share with you tips and tricks we have learned, as well as everything you need to get started using Slick in your Scala application.
I will begin with Slick fundamentals: how to get started making your connection, the types of databases it can access, how to actually create table objects and make queries to and from them. We will using these fundamentals to demonstrate the powerful features inherited from the Scala language itself: static-checking, compile-time safety, and compositionality. And throughout I will share plenty of tips that will help you in everything from getting started to connection pooling options and configuration for use at scale.
This session is for those who are excited by the great power of Apache Solr search for Drupal and want to take things even further. Do you want take complete control over your search interface and offer more than the default features? Have you ever wondered what it takes to add data to your search index? Curious about defining facets, custom sorting, or making cool new widgets for filtering and faceting? Join us for a technical deep dive into the world of Solr search.
The general topics of this presentation will overlap with those covered at Drupalcon SF for the Drupal 6 version, but we will focus on use of the API as found in the Drupal 7 version.
Introducing the Solr index
* Learn about Solr fields, and how to map Drupal data onto them
* See how to add data to the search index
* Execute a search in PHP code and use the results
Using the API for custom search paths and interfaces
* How to use the prepare and alter hooks for the query object, and why they differ.
* Make use facing changes, or add filters that are transparent to the user.
Build custom facets based on node fields
* What comes OOTB
* Hooks to add facets for additional field types
PHP and MySQL Tips and tricks, DC 2007Damien Seguy
Like opening a long hidden treasure chest, this session will bring many jewels back to the programming light. We'll cover a number of lesser known PHP function and MySQL functionalities, that will help at daily tasks. They will be applied in various fields, including security, performances, standard compliance and simply fun to program.
Slick is a modern database query and access library for Scala. It allows you to work with stored data almost as if you were using Scala collections while at the same time giving you full control over when a database access happens and which data is transferred. You can write your database queries in Scala instead of SQL, thus profiting from the static checking, compile-time safety and compositionality of Scala. Slick features an extensible query compiler which can generate code for different backends.
Overview of the new JSON processing functionality in MySQL: the new JSON type, the in-line JSON path expressions, the JSON functions and how to go about indexing JSON
Slick: Bringing Scala’s Powerful Features to Your Database Access Rebecca Grenier
This talk will teach you how to use Slick in practice, based on our experience at EatingWell Media Group. Slick is a totally different (and better!) relational database mapping tool that brings Scala’s powerful features to your database interactions, namely: static-checking, compile-time safety, and compositionality.
Here at EatingWell, we have learned quite a bit about Slick over the past two years as we transitioned from a PHP website to Scala. I will share with you tips and tricks we have learned, as well as everything you need to get started using Slick in your Scala application.
I will begin with Slick fundamentals: how to get started making your connection, the types of databases it can access, how to actually create table objects and make queries to and from them. We will using these fundamentals to demonstrate the powerful features inherited from the Scala language itself: static-checking, compile-time safety, and compositionality. And throughout I will share plenty of tips that will help you in everything from getting started to connection pooling options and configuration for use at scale.
This session is for those who are excited by the great power of Apache Solr search for Drupal and want to take things even further. Do you want take complete control over your search interface and offer more than the default features? Have you ever wondered what it takes to add data to your search index? Curious about defining facets, custom sorting, or making cool new widgets for filtering and faceting? Join us for a technical deep dive into the world of Solr search.
The general topics of this presentation will overlap with those covered at Drupalcon SF for the Drupal 6 version, but we will focus on use of the API as found in the Drupal 7 version.
Introducing the Solr index
* Learn about Solr fields, and how to map Drupal data onto them
* See how to add data to the search index
* Execute a search in PHP code and use the results
Using the API for custom search paths and interfaces
* How to use the prepare and alter hooks for the query object, and why they differ.
* Make use facing changes, or add filters that are transparent to the user.
Build custom facets based on node fields
* What comes OOTB
* Hooks to add facets for additional field types
PHP and MySQL Tips and tricks, DC 2007Damien Seguy
Like opening a long hidden treasure chest, this session will bring many jewels back to the programming light. We'll cover a number of lesser known PHP function and MySQL functionalities, that will help at daily tasks. They will be applied in various fields, including security, performances, standard compliance and simply fun to program.
Slick is a modern database query and access library for Scala. It allows you to work with stored data almost as if you were using Scala collections while at the same time giving you full control over when a database access happens and which data is transferred. You can write your database queries in Scala instead of SQL, thus profiting from the static checking, compile-time safety and compositionality of Scala. Slick features an extensible query compiler which can generate code for different backends.
Webscale PostgreSQL - JSONB and Horizontal Scaling StrategiesJonathan Katz
All data is relational and can be represented through relational algebra, right? Perhaps, but there are other ways to represent data, and the PostgreSQL team continues to work on making it easier and more efficient to do so!
With the upcoming 9.4 release, PostgreSQL is introducing the "JSONB" data type which allows for fast, compressed, storage of JSON formatted data, and for quick retrieval. And JSONB comes with all the benefits of PostgreSQL, like its data durability, MVCC, and of course, access to all the other data types and features in PostgreSQL.
How fast is JSONB? How do we access data stored with this type? What can it do with the rest of PostgreSQL? What can't it do? How can we leverage this new data type and make PostgreSQL scale horizontally? Follow along with our presentation as we try to answer these questions.
«1С-Битрикс» и сертификация ФСТЭК России1С-Битрикс
Когда делать аттестацию системы и что это такое
Что такое сертификация и для чего она нужна
Как эксплуатировать сертифицированное программное обеспечение (ПО)
Когда обязательно нужно использовать сертифицированное ПО, а когда – желательно
Сколько стоит сертифицированное ПО «1С-Битрикс» и как его купить
Долгожданный релиз pg_pathman 1.0 / Александр Коротков, Дмитрий Иванов (Post...Ontico
Механизм секционирования в Postgres имеет ряд ограничений, которые не позволяют использовать концепцию секционирования в полной мере. Среди таких ограничений можно выделить неэффективность планирования запросов для секционированных таблиц (линейный рост времени планирования при увеличении количества секций), отсутствие HASH-секционирования, необходимость ручного управления секциями.
В нашем докладе мы расскажем про расширение pg_pathman, которое позволяет обойти эти ограничения. pg_pathman реализует RANGE и HASH секционирования с логарифмическим и константным временами планирования соответственно. В pg_pathman поддерживается определение секции на этапе выполнения, конкурентное секционирование.
pg_pathman долго находился в стадии beta-тестирования, но теперь мы рады, наконец, сообщить о релизе 1.0. В докладе мы расскажем как про детали внутреннего устройства, так и про приёмы практического использования.
Zimbra is the leader in Open Source Email and Collaboration. In July 2016 we've released the v8.7 with enhancements for Service Providers like SSL SNI and a new Packaging System, as well as new Security Features like Postscreen to protect the MTA from SPAM and bad connections, and 2FA, giving to the users the opportunity to protect their Mailbox by using an external TOTP application in addition to their regular password. Zimbra Collaboration 8.7.1 was released in October 2016 fixing some upgrade issues from older ZCS issues, and adding Official Support for Ubuntu 16.04 LTS.
Present and future of Jsonb in PostgreSQL
Json - is an ubiquitous data format, which supported in almost any popular databases. PostgreSQL was the first relational database, which received support of native textual json and very efficient binary jsonb data types. Recently published SQL 2016 standard describes the JSON data type and specifies the functions and operators to work with json in SQL, which greatly simplifies the further development of json support in PostgreSQL. We compare existing features of json/jsonb data types with proposed SQL standard and discuss the ways how we could improve json/jsonb support in PostgreSQL.
PostgreSQL offers to application developers a rich support of json data type, providing known advantages of the json data model with traditional benefits of relational databases, such as declarative query language, rich query processing, transaction management providing ACID safety guarantees. However, current support of json is far from ideal, for example, json is still "foreign" data type to SQL - existed jsquery extension tries to implement their own query language, which is being powerfull, is opaque to Postgres planner and optimizer and not extendable. Extending SQL to support json, without commonly accepted standard, is difficult and perspectiveless task. Recently published SQL 2016 standard describes the JSON data type and specifies the functions and operators to work with json in SQL, which makes clear the direction of future development of json support in PostgreSQL. We present our ideas and prototype of future json data type in PostgreSQL with some further non-standard extensions and improvements in storage requirement and index support.
Postgres vs Mongo / Олег Бартунов (Postgres Professional)Ontico
РИТ++ 2017, Backend Conf
Зал Конгресс-холл, 6 июня, 17:00
Тезисы:
http://backendconf.ru/2017/abstracts/2781.html
Я хочу немного порушить стереотипы, что Postgres - это чисто реляционная СУБД из прошлого века, плохо приспособленная под реалии современных проектов. Недавно мы прогнали YCSB для последних версий Postgres и Mongodb и увидели их плюсы и минусы на разных типах нагрузки, о которых я буду рассказывать. ...
Jsquery - the jsonb query language with GIN indexing supportAlexander Korotkov
PostgreSQL 9.4 has new jsonb data type, which was designed for efficient work with json data. However, its query language is very limited and supports only a few operators. In this talk we introduce jsquery - the jsonb query language, which is flexible, expandable and has GIN indexing support. Jsquery provides postgres users an ability to talk to json data in an efficient way on par with NoSQL databases. The preliminary prototype was presented at PCGon-2014 and has got a good feedback, so now we want to show to european users the new version of jsquery (with some enhancements), which is compatible with 9.4 release and can be installed as an extension. We'll also discuss current issues of jsquery and possible ways of improvements.
JSON Processing in the Database using PostgreSQL 9.4 :: Data Wranglers DC :: ...Ryan B Harvey, CSDP, CSM
This slide deck was prepared for a talk on getting, processing, and reshaping JSON data using PostgreSQL 9.4 at the Data Wranglers DC meetup on January 7, 2015.
Associated materials are on GitHub at:
https://github.com/nihonjinrxs/dwdc-january2015
Meetup information: http://www.meetup.com/Data-Wranglers-DC/events/219112410/
It's an presentation about MVC pattern, which focuses on the major framework - Backbone. You will learn a knowledge of templating and data binding and learn how to manage dependencies in your application.
The JSON data type and functions that support it comprise one of the most interesting features introduced in MySQL 5.7 for application developers. But no feature is a Golden Hammer. We need to apply a little expertise to get the best of it, and avoid misusing it. I’ll show practical examples that work well with JSON, and other scenarios where conventional columns would perform better. Questions addressed in this presentation: How much space does JSON data use, compared to conventional data? What is the performance of querying JSON vs. conventional data? How do I create indexes for JSON data? What kind of data is best to store in JSON? How do I get the best of both worlds?
(EN) Last years NoSQL databases have matured and spread, without however threatening relational databases massive adoption. Relation database, however, did not relaxed but sooner or later they all introduced native support to JSON format. In this evening talk we will see how and when to use native JSON PostgreSQL data type.
(IT) Da qualche anno i database NoSQL sono maturati e si sono diffusi, senza riuscire tuttavia a minacciare il predominio dei database relazionali. Questi ultimi, dal canto loro, non sono rimasti a guardare ma – chi prima chi dopo – hanno introdotto il supporto nativo al formato JSON. In questa serata vedremo come e quando usare il formato JSON nativo di PostgreSQL.
N1QL = SQL + JSON. N1QL gives developers and enterprises an expressive, powerful, and complete language for querying, transforming, and manipulating JSON data. We begin with a brief overview. Couchbase 5.0 has language and performance improvements for pagination, index exploitation, integration, and more. We’ll walk through scenarios, features, and best practices.
Slides for Tom Marrs BJUG talk on 2/12/2013. See http://boulderjug.org/2013/01/tuesday-february-12-2013-a-night-with-tom-marrs-covering-json-and-rest.html
Quando uma aplicação começa a ficar grande e complexa, fazer buscas nos seus models torna-se uma tarefa complicada. Efetuar as buscas diretamente no banco de dados é um processo lento, ineficiente e que permite pouca ou nenhuma maleabilidade sobre a forma com que a busca é feita. Surge então o ElasticSearch, uma engine de busca utilizada por empresas como Github, Twitter e 4square para indexar e buscar literalmente milhões de documentos em tempo real. Nessa palestra, explicarei quando, como e porque utilizar o ElasticSearch para facilmente indexar e efetuar buscas complexas nos seus models.
Similar to CREATE INDEX … USING VODKA. VODKA CONNECTING INDEXES, Олег Бартунов, Александр Коротков (ГАИШ МГУ, Интаро) (20)
One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...Ontico
HighLoad++ 2017
Зал «Калининград», 8 ноября, 15:00
Тезисы:
http://www.highload.ru/2017/abstracts/2964.html
Одноклассники состоят из более чем восьми тысяч железных серверов, расположенных в нескольких дата-центрах. Каждая из этих машин была специализированной под конкретную задачу - как для обеспечения изоляции отказов, так и для обеспечения автоматизированного управления инфраструктурой.
...
Масштабируя DNS / Артем Гавриченков (Qrator Labs)Ontico
HighLoad++ 2017
Зал «Калининград», 8 ноября, 16:00
Тезисы:
http://www.highload.ru/2017/abstracts/3032.html
Протокол DNS на семь лет старше, чем Всемирная паутина. Стандарты RFC 882 и 883, определяющие основную функциональность системы доменных имён, появились в конце 1983 года, а первая реализация последовала уже годом позже. Естественно, что у технологии столь старой и при этом по сей день активнейшим образом используемой просто не могли не накопиться особенности, неочевидные обыкновенным пользователям.
...
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)Ontico
HighLoad++ 2017
Зал «Калининград», 8 ноября, 13:00
Тезисы:
http://www.highload.ru/2017/abstracts/3010.html
В этом докладе я расскажу, как BigData-платформа помогает трансформировать Почту России, как мы управляем построением и развитием платформы. Расскажу про найденные удачные решения, например, как разбиение на продукты с понятными SLA и интерфейсами между ними помогло нам сохранять управляемость с ростом масштабов проекта.
...
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 10:00
Тезисы:
http://www.highload.ru/2017/abstracts/2914.html
Казалось бы, что нужно для организации тестового окружения? Тестовая железка и копия боевого окружения - и тестовый сервер готов. Но как быть, когда проект сложный? А когда большой? А если нужно тестировать одновременно много версий? А если все это вместе?
Организация тестирования большого развивающегося проекта, где одновременно в разработке и тестировании около полусотни фич - достаточно непростая задача. Ситуация обычно осложняется тем, что иногда есть желание потрогать еще не полностью готовый функционал. В таких ситуациях часто возникает вопрос: "А куда это можно накатить и где покликать?"
...
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 18:00
Тезисы:
http://www.highload.ru/2017/abstracts/2854.html
Из этого доклада вы узнаете о возможностях репликации и автофейловера PostgreSQL, в том числе о возможностях, ставших доступных в PostgreSQL 10.
Среди прочих, будет затронуты следующие темы:
* Виды репликации и решаемые с ее помощью проблемы.
* Настройка потоковой репликации.
* Настройка логической репликации.
* Настройка автофейловера / HA средствами Stolon и Consul.
После прослушивания доклада вы сможете самостоятельно настраивать репликацию и автофейловер PostgreSQL.
PostgreSQL Configuration for Humans / Alvaro Hernandez (OnGres)Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 17:00
Тезисы:
http://www.highload.ru/2017/abstracts/3096.html
PostgreSQL is the world’s most advanced open source database. Indeed! With around 270 configuration parameters in postgresql.conf, plus all the knobs in pg_hba.conf, it is definitely ADVANCED!
How many parameters do you tune? 1? 8? 32? Anyone ever tuned more than 64?
No tuning means below par performance. But how to start? Which parameters to tune? What are the appropriate values? Is there a tool --not just an editor like vim or emacs-- to help users manage the 700-line postgresql.conf file?
Join this talk to understand the performance advantages of appropriately tuning your postgresql.conf file, showcase a new free tool to make PostgreSQL configuration possible for HUMANS, and learn the best practices for tuning several relevant postgresql.conf parameters.
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 16:00
Тезисы:
http://www.highload.ru/2017/abstracts/3115.html
During this session we will cover the last development in ProxySQL to support regular expressions (RE2 and PCRE) and how we can use this strong technique in correlation with ProxySQL's query rules to anonymize live data quickly and transparently. We will explain the mechanism and how to generate these rules quickly. We show live demo with all challenges we got from the Community and we finish the session by an interactive brainstorm testing queries from the audience.
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 15:00
Тезисы:
http://www.highload.ru/2017/abstracts/2957.html
Расскажем о нашем опыте разработки модуля межсетевого экрана для MySQL с использованием генератора парсеров ANTLR и языка Kotlin.
Подробно рассмотрим следующие вопросы:
— когда и почему целесообразно использовать ANTLR;
— особенности разработки ANTLR-грамматики для MySQL;
— сравнение производительности рантаймов для ANTLR в рамках задачи синтаксического анализа MySQL (C#, Java, Kotlin, Go, Python, PyPy, C++);
— вспомогательные DSL;
— микросервисная архитектура модуля экранирования SQL;
— полученные результаты.
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 14:00
Тезисы:
http://www.highload.ru/2017/abstracts/3114.html
ProxySQL aims to be the most powerful proxy in the MySQL ecosystem. It is protocol-aware and able to provide high availability (HA) and high performance with no changes in the application, using several built-in features and integration with clustering software. During this session we will quickly introduce its main features, so to better understand how it works. We will then describe multiple use case scenarios in which ProxySQL empowers large MySQL installations to provide HA with zero downtime, read/write split, query rewrite, sharding, query caching, and multiplexing using SSL across data centers.
MySQL Replication — Advanced Features / Петр Зайцев (Percona)Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 13:00
Тезисы:
http://www.highload.ru/2017/abstracts/2954.html
MySQL Replication is powerful and has added a lot of advanced features through the years. In this presentation we will look into replication technology in MySQL 5.7 and variants focusing on advanced features, what do they mean, when to use them and when not, Including.
When should you use STATEMENT, ROW or MIXED binary log format?
What is GTID in MySQL and MariaDB and why do you want to use them?
What is semi-sync replication and how is it different from lossless semi-sync?
...
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...Ontico
HighLoad++ 2017
Зал «Кейптаун», 8 ноября, 12:00
Тезисы:
http://www.highload.ru/2017/abstracts/3120.html
Количество разработчиков мобильных приложений Сбербанк Онлайн с начала 2016 года выросло на порядок. Для того чтобы продолжать выпускать качественный продукт, мы кардинально перестраиваем процесс разработки.
Количество внутренних заказчиков тех или иных доработок в какой-то момент выросло настолько, что разработчики стали узким местом. Мы внедрили культуру разработки, которую можно условно назвать "внутренним open-source", сохранив за собой контроль над архитектурой и качеством проекта, но позволив разрабатывать новые фичи всем желающим.
...
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...Ontico
HighLoad++ 2017
Зал «Мумбай», 8 ноября, 18:00
Тезисы:
http://www.highload.ru/2017/abstracts/2836.html
При использовании Eventually Consistent распределенных баз данных нет гарантий, что чтение возвращает результаты последних изменений данных, если чтение и запись производятся на разных узлах. Это ограничивает пропускную способность системы. Поддержка свойства Causal Consistency снимает это ограничение, что позволяет улучшить масштабируемость, не требуя изменений в коде приложения.
...
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...Ontico
HighLoad++ 2017
Зал «Мумбай», 8 ноября, 16:00
Тезисы:
http://www.highload.ru/2017/abstracts/2858.html
Аудитория Одноклассников превышает 73 миллиона человек в России, СНГ и странах дальнего зарубежья. При этом ОК.ru - первая социальная сеть по просмотрам видео в рунете и крупнейшая сервисная платформа.
Качественный и количественный рост DDoS-атак за последние годы превращает их в одну из первоочередных проблем для крупнейших интернет-ресурсов. В зависимости от вектора атаки “узким” местом становится та или иная часть инфраструктуры. В частности, при SYN-flood первый удар приходится на систему балансировки трафика. От ее производительности зависит успех в противостоянии атаке.
...
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)Ontico
HighLoad++ 2017
Зал «Мумбай», 8 ноября, 15:00
Тезисы:
http://www.highload.ru/2017/abstracts/3008.html
Никогда не было и вот снова случилось! Компания Google в результате перенаправления трафика сделала недостпуными в Японии несколько тысяч различных сервисов, большинство из которых никак не связано с самой компанией Google. Однако, подобные инциденты происходят с завидной регулярностью, вот только не всегда попадают в большие СМИ. У таких инцидентов могут быть разные причины, начиная от ошибок сетевых инженеров и заканчивая государственным регулированием.
...
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)Ontico
HighLoad++ 2017
Зал «Мумбай», 8 ноября, 14:00
Тезисы:
http://www.highload.ru/2017/abstracts/2925.html
Облака и виртуализация – современные тренды развития IT-технологий. Операторы связи строят свои TelcoClouds на стандартах NFV (Network Functions Virtualization) и SDN (Software-Defined Networking). В докладе начнем с основ виртуализации, далее разберемся, для чего используются NFV и SDN, потом полетим к облакам и вернемся на землю для решения практических задач!
...
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)Ontico
HighLoad++ 2017
Зал «Мумбай», 8 ноября, 10:00
Тезисы:
http://www.highload.ru/2017/abstracts/3045.html
Как мы заставили Druid работать в Одноклассниках.
«Druid is a high-performance, column-oriented, distributed data store» http://druid.io.
Мы расскажем о том, как, внедрив Druid, мы справились с ситуацией, когда MSSQL-based система статистики на 50 терабайт стала:
- медленной: средняя скорость ответа была в разы меньше требуемой (и увеличилась в 20 раз);
- нестабильной: в час пик статистика отставала до получаса (теперь ничего не отстает);
- дорогой: изменилась политика лицензирования Microsoft, расходы на лицензии могли составить миллионы долларов.
...
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)Ontico
HighLoad++ 2017
Зал «Рио-де-Жанейро», 8 ноября, 18:00
Тезисы:
http://www.highload.ru/2017/abstracts/2905.html
Прошло более года с того момента, как Microsoft выпустила первую версию своего нового фреймворка для разработки web-приложений ASP.NET Core, и с каждым днем он находит все больше поклонников. ASP.NET Core базируется на платформе .NET Core, кроссплатформенной версии платформы .NET c открытым исходным кодом. Теперь у С#-разработчиков появилась возможность использовать Mac в качестве среды разработки, и запускать приложения на Linux или внутри Docker-контейнеров.
...
100500 способов кэширования в Oracle Database или как достичь максимальной ск...Ontico
HighLoad++ 2017
Зал «Рио-де-Жанейро», 8 ноября, 14:00
Тезисы:
http://www.highload.ru/2017/abstracts/2913.html
Изначально будут раскрыты базовые причины, которые заставили появиться такой части механизма СУБД, как кэш результатов, и почему в ряде СУБД он есть или отсутствует.
Будут рассмотрены различные варианты кэширования результатов как sql-запросов, так и результатов хранимой в БД бизнес-логики. Произведено сравнение способов кэширования (программируемые вручную кэши, стандартный функционал) и даны рекомендации, когда и в каких случаях данные способы оптимальны, а порой опасны.
...
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...Ontico
HighLoad++ 2017
Зал «Рио-де-Жанейро», 8 ноября, 13:00
Тезисы:
http://www.highload.ru/2017/abstracts/2947.html
Apache Ignite — Open Source платформа для высокопроизводительной распределенной работы с большими данными с применением SQL или Java/.NET/C++ API. Ignite используют в самых разных отраслях. Сбербанк, ING, RingCentral, Microsoft, e-Therapeutics — все эти компании применяют решения на основе Ignite. Размеры кластеров разнятся от всего одного узла до нескольких сотен, узлы могут быть расположены в одном ЦОД-е или в нескольких геораспределенных.
...
HighLoad++ 2017
Зал «Рио-де-Жанейро», 8 ноября, 12:00
Тезисы:
http://www.highload.ru/2017/abstracts/3005.html
Когда мы говорим о нагруженных системах и базах данных с большим числом параллельных коннектов, особый интерес представляет практика эксплуатации и сопровождения таких проектов. В том числе инструменты и механизмы СУБД, которые могут быть использованы DBA и DevOps-инженерами для решения задач мониторинга жизнедеятельности базы данных и ранней диагностики возможных проблем.
...
1.Wireless Communication System_Wireless communication is a broad term that i...JeyaPerumal1
Wireless communication involves the transmission of information over a distance without the help of wires, cables or any other forms of electrical conductors.
Wireless communication is a broad term that incorporates all procedures and forms of connecting and communicating between two or more devices using a wireless signal through wireless communication technologies and devices.
Features of Wireless Communication
The evolution of wireless technology has brought many advancements with its effective features.
The transmitted distance can be anywhere between a few meters (for example, a television's remote control) and thousands of kilometers (for example, radio communication).
Wireless communication can be used for cellular telephony, wireless access to the internet, wireless home networking, and so on.
This 7-second Brain Wave Ritual Attracts Money To You.!nirahealhty
Discover the power of a simple 7-second brain wave ritual that can attract wealth and abundance into your life. By tapping into specific brain frequencies, this technique helps you manifest financial success effortlessly. Ready to transform your financial future? Try this powerful ritual and start attracting money today!
# Internet Security: Safeguarding Your Digital World
In the contemporary digital age, the internet is a cornerstone of our daily lives. It connects us to vast amounts of information, provides platforms for communication, enables commerce, and offers endless entertainment. However, with these conveniences come significant security challenges. Internet security is essential to protect our digital identities, sensitive data, and overall online experience. This comprehensive guide explores the multifaceted world of internet security, providing insights into its importance, common threats, and effective strategies to safeguard your digital world.
## Understanding Internet Security
Internet security encompasses the measures and protocols used to protect information, devices, and networks from unauthorized access, attacks, and damage. It involves a wide range of practices designed to safeguard data confidentiality, integrity, and availability. Effective internet security is crucial for individuals, businesses, and governments alike, as cyber threats continue to evolve in complexity and scale.
### Key Components of Internet Security
1. **Confidentiality**: Ensuring that information is accessible only to those authorized to access it.
2. **Integrity**: Protecting information from being altered or tampered with by unauthorized parties.
3. **Availability**: Ensuring that authorized users have reliable access to information and resources when needed.
## Common Internet Security Threats
Cyber threats are numerous and constantly evolving. Understanding these threats is the first step in protecting against them. Some of the most common internet security threats include:
### Malware
Malware, or malicious software, is designed to harm, exploit, or otherwise compromise a device, network, or service. Common types of malware include:
- **Viruses**: Programs that attach themselves to legitimate software and replicate, spreading to other programs and files.
- **Worms**: Standalone malware that replicates itself to spread to other computers.
- **Trojan Horses**: Malicious software disguised as legitimate software.
- **Ransomware**: Malware that encrypts a user's files and demands a ransom for the decryption key.
- **Spyware**: Software that secretly monitors and collects user information.
### Phishing
Phishing is a social engineering attack that aims to steal sensitive information such as usernames, passwords, and credit card details. Attackers often masquerade as trusted entities in email or other communication channels, tricking victims into providing their information.
### Man-in-the-Middle (MitM) Attacks
MitM attacks occur when an attacker intercepts and potentially alters communication between two parties without their knowledge. This can lead to the unauthorized acquisition of sensitive information.
### Denial-of-Service (DoS) and Distributed Denial-of-Service (DDoS) Attacks
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBrad Spiegel Macon GA
Brad Spiegel Macon GA’s journey exemplifies the profound impact that one individual can have on their community. Through his unwavering dedication to digital inclusion, he’s not only bridging the gap in Macon but also setting an example for others to follow.
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC
Ellisha Heppner, Grant Management Lead, presented an update on APNIC Foundation to the PNG DNS Forum held from 6 to 10 May, 2024 in Port Moresby, Papua New Guinea.
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesSanjeev Rampal
Talk presented at Kubernetes Community Day, New York, May 2024.
Technical summary of Multi-Cluster Kubernetes Networking architectures with focus on 4 key topics.
1) Key patterns for Multi-cluster architectures
2) Architectural comparison of several OSS/ CNCF projects to address these patterns
3) Evolution trends for the APIs of these projects
4) Some design recommendations & guidelines for adopting/ deploying these solutions.
5. Semi-structured data in PostgreSQL
• FTS — OpenFTS in 2000, in-core since 8.3
• hstore — as contrib/hstore since 8.3
• XML — in-core text data type since 8.2, contrib/xml2 since 8.3
• json — in-core text data type since 9.2, access functions since 9.3
• jsonb — in-core binary data type since 9.4
6. Jsonb vs Json
SELECT '{"c":0, "a":2,"a":1}'::json, '{"c":0, "a":2,"a":1}'::jsonb;
json | jsonb
-----------------------+------------------
{"c":0, "a":2,"a":1} | {"a": 1, "c": 0}
(1 row)
• json: textual storage «as is»
• jsonb: no whitespaces
• jsonb: no duplicate keys, last key win
• jsonb: keys are sorted
7. Jsonb vs Json
• Data
• 1,252,973 bookmarks from Delicious in json format (js)
• The same bookmarks in jsonb format (jb)
• The same bookmarks as text (tx)
=# dt+
List of relations
Schema | Name | Type | Owner | Size | Description
--------+------+-------+----------+---------+-------------
public | jb | table | postgres | 1374 MB | overhead is < 4%
public | js | table | postgres | 1322 MB |
public | tx | table | postgres | 1322 MB |
8. Jsonb query
Currently (9.4) , one can search jsonb data using:
• Contains operators - jsonb @> jsonb, jsonb <@ jsonb (GIN indexes)
jb @> '{"tags":[{"term":"NYC"}]}'::jsonb
Keys should be specified from root
● Equivalence operator — jsonb = jsonb (GIN indexes)
• Exists operators — jsonb ? text, jsonb ?! text[], jsonb ?& text[] (GIN indexes)
jb WHERE jb ?| '{tags,links}'
Only root keys supported
• Operators on jsonb parts (functional indexes)
SELECT ('{"a": {"b":5}}'::jsonb -> 'a'->>'b')::int > 2;
CREATE INDEX ….USING BTREE ( (jb->'a'->>'b')::int);
Very cumbersome, too many functional indexes
9. Jsonb querying an array: simple case
Find bookmarks with tag «NYC»:
SELECT *
FROM js
WHERE js @> '{"tags":[{"term":"NYC"}]}';
10. Jsonb querying an array: complex case
Find companies where CEO or CTO is called Neil.
One could write...
SELECT * FROM company
WHERE js @> '{"relationships":[{"person":{"first_name":"Neil"}}]}'
AND
(js @> '{"relationships":[{"title":"CTO"}]}' OR
js @> '{"relationships":[{"title":"CEO"}]}');
11. Jsonb querying an array: complex case
Each «@>» is processed independently.
SELECT * FROM company
WHERE js @> '{"relationships":[{"person":{"first_name":"Neil"}}]}'
AND
(js @> '{"relationships":[{"title":"CTO"}]}' OR
js @> '{"relationships":[{"title":"CEO"}]}');
Actually, this query searches for companies with some
CEO or CTO and someone called Neil...
12. Jsonb querying an array: complex case
The correct version of the query is:
SELECT * FROM company
WHERE js @> '{"relationships":
[{"title":"CEO", "person":{"first_name":"Neil"}}]}' OR
js @> '{"relationships":
[{"title":"CTO", "person":{"first_name":"Neil"}}]}';
When constructing complex conditions over the same
array element, query length can grow exponentially.
13. Jsonb querying an array: another approach
Using subselect and jsonb_array_elements:
SELECT * FROM company
WHERE EXISTS (
SELECT 1
FROM jsonb_array_elements(js -> 'relationships') t
WHERE t->>'title' IN ('CEO', 'CTO') AND
t ->'person'->>'first_name' = 'Neil');
14. Jsonb querying an array: summary
Using «@>»
• Pro
• Indexing support
• Cons
• Checks only equality for scalars
• Hard to explain complex logic
Using subselect and
jsonb_array_elements
• Pro
• Full power of SQL can be used to
express condition over element
• Cons
• No indexing support
• Heavy syntax
15. Jsonb query
• Need Jsonb query language
• Simple and effective way to search in arrays (and other iterative searches)
• More comparison operators
• Types support
• Schema support (constraints on keys, values)
• Indexes support
• Introduce Jsquery - textual data type and @@ match operator
jsonb @@ jsquery
16. Jsonb query language (Jsquery)
value_list
::= scalar_value
| value_list ',' scalar_value
array ::= '[' value_list ']'
scalar_value
::= null
| STRING
| true
| false
| NUMERIC
| OBJECT
…....
Expr ::= path value_expr
| path HINT value_expr
| NOT expr
| NOT HINT value_expr
| NOT value_expr
| path '(' expr ')'
| '(' expr ')'
| expr AND expr
| expr OR expr
path ::= key
| path '.' key_any
| NOT '.' key_any
key ::= '*'
| '#'
| '%'
| '$'
| STRING
….....
key_any ::= key
| NOT
value_expr
::= '=' scalar_value
| IN '(' value_list ')'
| '=' array
| '=' '*'
| '<' NUMERIC
| '<' '=' NUMERIC
| '>' NUMERIC
| '>' '=' NUMERIC
| '@' '>' array
| '<' '@' array
| '&' '&' array
| IS ARRAY
| IS NUMERIC
| IS OBJECT
| IS STRING
| IS BOOLEAN
17. Jsonb query language (Jsquery)
• # - any element array
• % - any key
• * - anything
• $ - current element
SELECT '{"a": {"b": [1,2,3]}}'::jsonb @@ 'a.b.# = 2';
SELECT '{"a": {"b": [1,2,3]}}'::jsonb @@ '%.b.# = 2';
SELECT '{"a": {"b": [1,2,3]}}'::jsonb @@ '*.# = 2';
select '{"a": {"b": [1,2,3]}}'::jsonb @@ 'a.b.# ($ = 2 OR $ < 3)';
• Use "double quotes" for key !
select 'a1."12222" < 111'::jsquery;
path ::= key
| path '.' key_any
| NOT '.' key_any
key ::= '*'
| '#'
| '%'
| '$'
| STRING
….....
key_any ::= key
| NOT
19. Jsonb query language (Jsquery)
• Type checking
select '{"x": true}' @@ 'x IS boolean'::jsquery,
'{"x": 0.1}' @@ 'x IS numeric'::jsquery;
?column? | ?column?
----------+----------
t | t
IS BOOLEAN
IS NUMERIC
IS ARRAY
IS OBJECT
select '{"a":{"a":1}}' @@ 'a IS object'::jsquery; IS STRING
?column?
----------
t
select '{"a":["xxx"]}' @@ 'a IS array'::jsquery, '["xxx"]' @@ '$ IS array'::jsquery;
?column? | ?column?
----------+----------
t | t
20. How many products are similar to "B000089778"
and have product_sales_rank in range between 10000-20000 ?
{
"customer_id": "AE22YDHSBFYIP",
"product_category": "Business & Investing",
"product_group": "Book",
"product_id": "1551803542",
"product_sales_rank": 11611,
"product_subcategory": "General",
"product_title": "Start and Run a Coffee Bar (Start & Run a)",
"review_date": {
"$date": 31363200000
},
"review_helpful_votes": 0,
"review_rating": 5,
"review_votes": 10,
"similar_product_ids": [
"0471136174",
"0910627312",
"047112138X",
"0786883561",
"0201570483"
]
}
21. Jsonb query language (Jsquery)
• SQL
SELECT count(*) FROM jr WHERE (jr->>'product_sales_rank')::int > 10000
and (jr->> 'product_sales_rank')::int < 20000 and
….boring stuff
• Jsquery
SELECT count(*) FROM jr WHERE jr @@ ' similar_product_ids &&
["B000089778"] AND product_sales_rank( $ > 10000 AND $ < 20000)'
• Mongodb
db.reviews.find( { $and :[ {similar_product_ids: { $in ["B000089778"]}},
{product_sales_rank:{$gt:10000, $lt:20000}}] } ).count()
22. «#», «*», «%» usage rules
Each usage of «#», «*», «%» means separate element
• Find companies where CEO or CTO is called Neil.
SELECT count(*) FROM company WHERE js @@ 'relationships.#
(title in ("CEO", "CTO") AND person.first_name = "Neil")'::jsquery;
count
-------
12
• Find companies with some CEO or CTO and someone called Neil
SELECT count(*) FROM company WHERE js @@ 'relationships(#.title in ("CEO",
"CTO") AND #.person.first_name = "Neil")'::jsquery;
count
-------
69
23. Jsonb query language (Jsquery)
explain( analyze, buffers) select count(*) from jb where jb @> '{"tags":[{"term":"NYC"}]}'::jsonb;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------
Aggregate (cost=191517.30..191517.31 rows=1 width=0) (actual time=1039.422..1039.423 rows=1 loops=1)
Buffers: shared hit=97841 read=78011
-> Seq Scan on jb (cost=0.00..191514.16 rows=1253 width=0) (actual time=0.006..1039.310 rows=285 loops=1)
Filter: (jb @> '{"tags": [{"term": "NYC"}]}'::jsonb)
Rows Removed by Filter: 1252688
Buffers: shared hit=97841 read=78011
Planning time: 0.074 ms
Execution time: 1039.444 ms
explain( analyze,costs off) select count(*) from jb where jb @@ 'tags.#.term = "NYC"';
QUERY PLAN
--------------------------------------------------------------------
Aggregate (actual time=891.707..891.707 rows=1 loops=1)
-> Seq Scan on jb (actual time=0.010..891.553 rows=285 loops=1)
Filter: (jb @@ '"tags".#."term" = "NYC"'::jsquery)
Rows Removed by Filter: 1252688
Execution time: 891.745 ms
24. Jsquery (indexes)
• GIN opclasses with jsquery support
• jsonb_value_path_ops
• use Bloom filtering for key matching
• Good for key matching (wildcard support)
• not good for range query
• jsonb_path_value_ops
• hash path (like jsonb_path_ops)
• No wildcard support, no problem with ranges
List of relations
Schema | Name | Type | Owner | Table | Size | Description
--------+-------------------------+-------+----------+--------------+---------+-------------
public | jb | table | postgres | | 1374 MB |
public | jb_value_path_idx | index | postgres | jb | 306 MB |
public | jb_gin_idx | index | postgres | jb | 544 MB |
public | jb_path_value_idx | index | postgres | jb | 306 MB |
public | jb_path_idx | index | postgres | jb | 251 MB |
25. Jsquery (indexes)
explain( analyze,costs off) select count(*) from jb where jb @@ 'tags.#.term = "NYC"';
QUERY PLAN
-------------------------------------------------------------------------------------------------
Aggregate (actual time=0.609..0.609 rows=1 loops=1)
-> Bitmap Heap Scan on jb (actual time=0.115..0.580 rows=285 loops=1)
Recheck Cond: (jb @@ '"tags".#."term" = "NYC"'::jsquery)
Heap Blocks: exact=285
-> Bitmap Index Scan on jb_value_path_idx (actual time=0.073..0.073 rows=285 loops=1)
Index Cond: (jb @@ '"tags".#."term" = "NYC"'::jsquery)
Execution time: 0.634 ms
(7 rows)
26. Jsquery (indexes)
explain( analyze,costs off) select count(*) from jb where jb @@ '*.term = "NYC"';
QUERY PLAN
-------------------------------------------------------------------------------------------------
Aggregate (actual time=0.688..0.688 rows=1 loops=1)
-> Bitmap Heap Scan on jb (actual time=0.145..0.660 rows=285 loops=1)
Recheck Cond: (jb @@ '*."term" = "NYC"'::jsquery)
Heap Blocks: exact=285
-> Bitmap Index Scan on jb_value_path_idx (actual time=0.113..0.113 rows=285 loops=1)
Index Cond: (jb @@ '*."term" = "NYC"'::jsquery)
Execution time: 0.716 ms
(7 rows)
27. Summary: PostgreSQL 9.4 vs Mongo 2.6.0
• Search for tag on delicious bookmarks
• json : 10 s seqscan
• jsonb : 8.5 ms GIN jsonb_ops
• jsonb : 0.7 ms GIN jsonb_path_ops
• jsquery : 0.6 ms GIN jsonb_path_value_ops
• jsquery : 0.7 ms GIN jsonb_value_path_ops
• mongo : 1.0 ms btree index
• Index size
•Table size
•postgres : 1.3Gb
•mongo : 1.8Gb
•Input performance:
• Text : 34 s
• Json : 37 s
• Jsonb : 43 s
• mongo : 13 m
• jsonb_ops - 636 Mb
• jsonb_path_ops - 295 Mb
• jsonb_path_value_ops - 306 Mb
• jsonb_value_path_ops - 306 Mb
• jsonb_path_ops (tags) - 44 Mb USING gin((jb->'tags') jsonb_path_ops
• mongo (tags) - 387 Mb
• mongo (tags.term) - 100 Mb
28. Citus dataset {
"customer_id": "AE22YDHSBFYIP",
"product_category": "Business & Investing",
"product_group": "Book",
"product_id": "1551803542",
"product_sales_rank": 11611,
"product_subcategory": "General",
"product_title": "Start and Run a Coffee Bar (Start & Run a)",
"review_date": {
"$date": 31363200000
},
"review_helpful_votes": 0,
"review_rating": 5,
"review_votes": 10,
"similar_product_ids": [
"0471136174",
"0910627312",
"047112138X",
"0786883561",
"0201570483"
]
}
• 3023162 reviews from Citus
1998-2000 years
• 1573 MB
29. Jsquery (indexes)
explain (analyze, costs off) select count(*) from jr where
jr @@ ' similar_product_ids && ["B000089778"]';
QUERY PLAN
------------------------------------------------------------------------------------------------
Aggregate (actual time=0.359..0.359 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=0.084..0.337 rows=185 loops=1)
Recheck Cond: (jr @@ '"similar_product_ids" && ["B000089778"]'::jsquery)
Heap Blocks: exact=107
-> Bitmap Index Scan on jr_path_value_idx (actual time=0.057..0.057 rows=185 loops=1)
Index Cond: (jr @@ '"similar_product_ids" && ["B000089778"]'::jsquery)
Execution time: 0.394 ms
(7 rows)
30. Jsquery (indexes)
• No statistics, no planning :(
explain (analyze, costs off) select count(*) from jr where
jr @@ ' similar_product_ids && ["B000089778"]
AND product_sales_rank( $ > 10000 AND $ < 20000)';
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Aggregate (actual time=126.149..126.149 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=126.057..126.143 rows=45 loops=1)
Recheck Cond: (jr @@ '("similar_product_ids" && ["B000089778"] &
"product_sales_rank"($ > 10000 & $ < 20000))'::jsquery)
Heap Blocks: exact=45
-> Bitmap Index Scan on jr_path_value_idx (actual time=126.029..126.029 rows=45 loops=1)
Index Cond: (jr @@ '("similar_product_ids" && ["B000089778"] &
"product_sales_rank"($ > 10000 & $ < 20000))'::jsquery)
Execution time: 129.309 ms !!! No statistics
(7 rows)
Not selective, better not use index!
32. Jsquery (indexes)
• Jsquery is opaque to planner, we could rewrite query and use planner
explain (analyze,costs off) select count(*) from jr where
jr @@ ' similar_product_ids && ["B000089778"]'
and (jr->>'product_sales_rank')::int>10000 and (jr->>'product_sales_rank')::int<20000;
-----------------------------------------------------------------------------------------------------------------------------------------
Aggregate (actual time=0.479..0.479 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=0.079..0.472 rows=45 loops=1)
Recheck Cond: (jr @@ '"similar_product_ids" && ["B000089778"]'::jsquery)
Filter: ((((jr ->> 'product_sales_rank'::text))::integer > 10000) AND
(((jr ->> 'product_sales_rank'::text))::integer < 20000))
Rows Removed by Filter: 140
Heap Blocks: exact=107
-> Bitmap Index Scan on jr_path_value_idx (actual time=0.041..0.041 rows=185 loops=1)
Index Cond: (jr @@ '"similar_product_ids" && ["B000089778"]'::jsquery)
Execution time: 0.506 ms vs 7 ms MongoDB !
(9 rows)
33. Jsquery (optimizer) — NEW !
• Jsquery now has built-in simple optimiser.
explain (analyze, costs off) select count(*) from jr where
jr @@ 'similar_product_ids && ["B000089778"]
AND product_sales_rank( $ > 10000 AND $ < 20000)'
------------------------------------------------------------------------------------------------------------------------------------------
Aggregate (actual time=0.422..0.422 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=0.099..0.416 rows=45 loops=1)
Recheck Cond: (jr @@ '("similar_product_ids" && ["B000089778"] AND
"product_sales_rank"($ > 10000 AND $ < 20000))'::jsquery)
Rows Removed by Index Recheck: 140
Heap Blocks: exact=107
-> Bitmap Index Scan on jr_path_value_idx (actual time=0.060..0.060 rows=185 loops=1)
Index Cond: (jr @@ '("similar_product_ids" && ["B000089778"] AND
"product_sales_rank"($ > 10000 AND $ < 20000))'::jsquery)
Execution time: 0.480 ms vs 7 ms MongoDB !
34. Jsquery (optimizer) — NEW !
• Since GIN opclasses can't expose something special to explain output,
jsquery optimiser has its own explain functions:
• text gin_debug_query_path_value(jsquery) — explain for jsonb_path_value_ops
# SELECT gin_debug_query_path_value('x = 1 AND (*.y = 1 OR y = 2)');
gin_debug_query_path_value
----------------------------
x = 1 , entry 0 +
• text gin_debug_query_value_path(jsquery) — explain for jsonb_value_path_ops
# SELECT gin_debug_query_value_path('x = 1 AND (*.y = 1 OR y = 2)');
gin_debug_query_value_path
----------------------------
AND +
x = 1 , entry 0 +
OR +
*.y = 1 , entry 1 +
y = 2 , entry 2 +
35. Jsquery (optimizer) — NEW !
Jsquery now has built-in optimiser for simple queries.
Analyze query tree and push non-selective parts to recheck (like filter)
Selectivity classes:
1) Equality (x = c)
2) Range (c1 < x < c2)
3) Inequality (c > c1)
4) Is (x is type)
5) Any (x = *)
36. Jsquery (optimizer) — NEW !
AND children can be put into recheck.
# SELECT gin_debug_query_path_value('x = 1 AND y > 0');
gin_debug_query_path_value
----------------------------
x = 1 , entry 0 +
While OR children can't. We can't handle false negatives.
# SELECT gin_debug_query_path_value('x = 1 OR y > 0');
gin_debug_query_path_value
----------------------------
OR +
x = 1 , entry 0 +
y > 0 , entry 1 +
37. Jsquery (optimizer) — NEW !
Can't do much with NOT, because hash is lossy. After NOT false positives
turns into false negatives, which we can't handle.
# SELECT gin_debug_query_path_value('x = 1 AND (NOT y = 0)');
gin_debug_query_path_value
----------------------------
x = 1 , entry 0 +
38. Jsquery (optimizer) — NEW !
• Jsquery optimiser pushes non-selective operators to recheck
explain (analyze, costs off) select count(*) from jr where
jr @@ 'similar_product_ids && ["B000089778"]
AND product_sales_rank( $ > 10000 AND $ < 20000)'
------------------------------------------------------------------------------------------------------------------------------------------
Aggregate (actual time=0.422..0.422 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=0.099..0.416 rows=45 loops=1)
Recheck Cond: (jr @@ '("similar_product_ids" && ["B000089778"] AND
"product_sales_rank"($ > 10000 AND $ < 20000))'::jsquery)
Rows Removed by Index Recheck: 140
Heap Blocks: exact=107
-> Bitmap Index Scan on jr_path_value_idx (actual time=0.060..0.060 rows=185 loops=1)
Index Cond: (jr @@ '("similar_product_ids" && ["B000089778"] AND
"product_sales_rank"($ > 10000 AND $ < 20000))'::jsquery)
Execution time: 0.480 ms
39. Jsquery (HINTING) — NEW !
• Jsquery now has HINTING ( if you don't like optimiser)!
explain (analyze, costs off) select count(*) from jr where jr @@ 'product_sales_rank > 10000'
----------------------------------------------------------------------------------------------------------
Aggregate (actual time=2507.410..2507.410 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=1118.814..2352.286 rows=2373140 loops=1)
Recheck Cond: (jr @@ '"product_sales_rank" > 10000'::jsquery)
Heap Blocks: exact=201209
-> Bitmap Index Scan on jr_path_value_idx (actual time=1052.483..1052.48
rows=2373140 loops=1)
Index Cond: (jr @@ '"product_sales_rank" > 10000'::jsquery)
Execution time: 2524.951 ms
• Better not to use index — HINT /* --noindex */
explain (analyze, costs off) select count(*) from jr where jr @@ 'product_sales_rank /*-- noindex */ > 10000';
----------------------------------------------------------------------------------
Aggregate (actual time=1376.262..1376.262 rows=1 loops=1)
-> Seq Scan on jr (actual time=0.013..1222.123 rows=2373140 loops=1)
Filter: (jr @@ '"product_sales_rank" /*-- noindex */ > 10000'::jsquery)
Rows Removed by Filter: 650022
Execution time: 1376.284 ms
40. Jsquery (HINTING) — NEW !
• If you know that inequality is selective then use HINT /* --index */
# explain (analyze, costs off) select count(*) from jr where jr @@ 'product_sales_rank /*-- index*/ > 3000000 AND
review_rating = 5'::jsquery;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------
Aggregate (actual time=12.307..12.307 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=11.259..12.244 rows=739 loops=1)
Recheck Cond: (jr @@ '("product_sales_rank" /*-- index */ > 3000000 AND "review_rating" = 5)'::jsquery)
Heap Blocks: exact=705
-> Bitmap Index Scan on jr_path_value_idx (actual time=11.179..11.179 rows=739 loops=1)
Index Cond: (jr @@ '("product_sales_rank" /*-- index */ > 3000000 AND "review_rating" = 5)'::jsquery)
Execution time: 12.359 ms vs 1709.901 ms (without hint)
(7 rows)
41. Contrib/jsquery
• Jsquery index support is quite efficient ( 0.5 ms vs Mongo 7 ms ! )
• Future direction
• Make jsquery planner friendly
• Need statistics for jsonb
• Availability
• Jsquery + opclasses are available as extensions
• Grab it from https://github.com/akorotkov/jsquery (branch master) ,
we need your feedback !
• We will release it after PostgreSQL 9.4 release
• Need real sample data and queries !
42. PostgreSQL 9.4+
● Open-source
● Relational database
● Strong support of json
43. Why PostgreSQL is better than MongoDB
• Effective binary storage for json (jsonb type)
• GIN indexes (compact and fast)
•Durability and reliability are proven by dozens of years
•High concurrency and performance
44. JsQuery limitations
• Variables are always on the left size
x = 1 – OK
1 = x – Error!
• No calculations in query
x + y = 0 — Error!
• No extra datatypes and search operators
point(x,y) <@ '((0,0),(1,1),(2,1),(1,0))'::polygon
47. JsQuery language goals
• Provide rich enough query language for jsonb in 9.4.
• Indexing support for 'jsonb @@ jsquery':
• Two GIN opclasses are in jsquery itself
• VODKA opclasses was tested on jsquery
It's NOT intended to be solution for jsonb querying in
long term!
48. What JsQuery is NOT?
It's not designed to be another extendable, full weight:
• Parser
• Executor
•Optimizer
It's NOT SQL inside SQL.
49. Jsonb querying an array: summary –! no
statistics!
Using «@>»
• Pro
• Indexing support
• Cons
• Checks only equality for
scalars
• Hard to explain complex
logic
Using subselect and
jsonb_array_elements
• Pro
• SQL-rich
• Cons
• No indexing support
• Heavy syntax
JsQuery
• Pro
• Indexing support
• Rich enough for typical
applications
• Cons
• Not extendable
Still looking for a better solution!
50. Jsonb query: future
Users want jsonb query language to be as rich
as SQL. How to satisfy them?..
51. Jsonb query: future
Users want jsonb query language to be as rich
as SQL. How to satisfy them?
Bring all required features to SQL-level!
52. Jsonb query: future
Functional equivalents:
• SELECT * FROM company WHERE EXISTS (SELECT 1
FROM jsonb_array_elements(js->'relationships') t
WHERE t->>'title' IN ('CEO', 'CTO') AND
t->'person'->>'first_name' = 'Neil');
• SELECT count(*) FROM company WHERE js @@ 'relationships(#.title in
("CEO", "CTO") AND #.person.first_name = "Neil")'::jsquery;
• SELECT * FROM company WHERE
ANYELEMENT OF js-> 'relationships' AS t (
t->>'title' IN ('CEO', 'CTO') AND
t ->'person'->>'first_name' = 'Neil');
53. Jsonb query: ANYELEMENT
Possible implementation steps:
• Implement ANYELEMENT as syntactic sugar and only for arrays.
• Support for various data types (extendable?)
• Handle ANYLEMENT as expression not subselect (problem with
alias).
• Indexing support over ANYELEMENT expressions.
54. Another idea about ANYLEMENENT
Functional equivalents:
• SELECT t
FROM company,
LATERAL (SELECT t FROM
jsonb_array_elements(js->'relationships') t) el;
• SELECT t
FROM company,
ANYELEMENT OF js->'relationships' AS t;
55. Better indexing ...
• GIN is a proven and effective index access method
• Need indexing for jsonb with operations on paths (no hash!) and values
• B-tree in entry tree is not good - length limit, no prefix compression
List of relations
Schema | Name | Type | Owner | Table | Size | Description
--------+-----------------------------+-------+----------+---------------+---------+-------------
public | jb | table | postgres | | 1374 MB |
public | jb_uniq_paths | table | postgres | | 912 MB |
public | jb_uniq_paths_btree_idx | index | postgres | jb_uniq_paths | 885 MB |text_pattern_ops
public | jb_uniq_paths_spgist_idx | index | postgres | jb_uniq_paths | 598 MB |now much less !
56. Better indexing ...
• Provide interface to change hardcoded B-tree in Entry tree
• Use spgist opclass for storing paths and values as is (strings hashed in values)
• We may go further - provide interface to change hardcoded B-tree in
posting tree
• GIS aware full text search !
• New index access method
CREATE INDEX … USING VODKA
57. GIN History
• Introduced at PostgreSQL Anniversary Meeting in Toronto, Jul 7-8, 2006
by Oleg Bartunov and Teodor Sigaev
58. GIN History
• Introduced at PostgreSQL Anniversary Meeting in Toronto, Jul 7-8, 2006
by Oleg Bartunov and Teodor Sigaev
• Supported by JFG Networks (France)
• «Gin stands for Generalized Inverted iNdex and should be considered as
a genie, not a drink.»
• Alexander Korotkov, Heikki Linnakangas have joined GIN++ development
in 2013
59. GIN History
• From GIN Readme, posted in -hackers, 2006-04-26
TODO
----
Nearest future:
* Opclasses for all types (no programming, just many catalog changes).
Distant future:
* Replace B-tree of entries to something like GiST (VODKA ! 2014)
* Add multicolumn support
* Optimize insert operations (background index insertion)
60. GIN problems with jsonb
• Have to store hash or bloom of path (storing full pathes would lead to
very long keys)
• But we need to use complex conditions over keys
• We want to use different complex tree types for same jsonb dataset (B-tree
for scalars, R-tree for geometry, RD-tree for sets etc.)
61. GIN index structure for jsonb
{
"product_group": "Book",
"product_sales_rank": 15000
},
{
"product_group": "Music",
"product_sales_rank": 25000
}
62. Vodka index structure for jsonb
{
"product_group": "Book",
"product_sales_rank": 15000
},
{
"product_group": "Music",
"product_sales_rank": 25000
}
63. CREATE INDEX … USING VODKA
• Delicious bookmarks, mostly text data
set maintenance_work_mem = '1GB';
List of relations
Schema | Name | Type | Owner | Table | Size | Description
--------+--------------------+-------+----------+-------+---------+-------------
public | jb | table | postgres | | 1374 MB | 1252973 rows
public | jb_value_path_idx | index | postgres | jb | 306 MB | 98769.096
public | jb_gin_idx | index | postgres | jb | 544 MB | 129860.859
public | jb_path_value_idx | index | postgres | jb | 306 MB | 100560.313
public | jb_path_idx | index | postgres | jb | 251 MB | 68880.320
public | jb_vodka_idx | index | postgres | jb | 409 MB | 185362.865
public | jb_vodka_idx5 | index | postgres | jb | 325 MB | 174627.234 new spgist
(6 rows)
64. CREATE INDEX … USING VODKA
select count(*) from jb where jb @@ 'tags.#.term = "NYC"';
-------------------------------------------------------------------------------------------
Aggregate (actual time=0.423..0.423 rows=1 loops=1)
-> Bitmap Heap Scan on jb (actual time=0.146..0.404 rows=285 loops=1)
Recheck Cond: (jb @@ '"tags".#."term" = "NYC"'::jsquery)
Heap Blocks: exact=285
-> Bitmap Index Scan on jb_vodka_idx (actual time=0.108..0.108 rows=285 loops=1)
Index Cond: (jb @@ '"tags".#."term" = "NYC"'::jsquery)
Execution time: 0.456 ms (0.634 ms, GIN jsonb_value_path_ops)
select count(*) from jb where jb @@ '*.term = "NYC"';
-------------------------------------------------------------------------------------------
Aggregate (actual time=0.495..0.495 rows=1 loops=1)
-> Bitmap Heap Scan on jb (actual time=0.245..0.474 rows=285 loops=1)
Recheck Cond: (jb @@ '*."term" = "NYC"'::jsquery)
Heap Blocks: exact=285
-> Bitmap Index Scan on jb_vodka_idx (actual time=0.214..0.214 rows=285 loops=1)
Index Cond: (jb @@ '*."term" = "NYC"'::jsquery)
Execution time: 0.526 ms (0.716 ms, GIN jsonb_path_value_ops)
65. CREATE INDEX … USING VODKA
• CITUS data, text and numeric
set maintenance_work_mem = '1GB';
List of relations
Schema | Name | Type | Owner | Table | Size | Description
--------+--------------------+-------+----------+-------+---------+-------------
public | jr | table | postgres | | 1573 MB | 3023162 rows
public | jr_value_path_idx | index | postgres | jr | 196 MB | 79180.120
public | jr_gin_idx | index | postgres | jr | 235 MB | 111814.929
public | jr_path_value_idx | index | postgres | jr | 196 MB | 73369.713
public | jr_path_idx | index | postgres | jr | 180 MB | 48981.307
public | jr_vodka_idx3 | index | postgres | jr | 240 MB | 155714.777
public | jr_vodka_idx4 | index | postgres | jr | 211 MB | 169440.130 new spgist
(6 rows)
66. CREATE INDEX … USING VODKA
explain (analyze, costs off) select count(*) from jr where jr @@ ' similar_product_ids && ["B000089778"]';
QUERY PLAN
-------------------------------------------------------------------------------------------
Aggregate (actual time=0.200..0.200 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=0.090..0.183 rows=185 loops=1)
Recheck Cond: (jr @@ '"similar_product_ids" && ["B000089778"]'::jsquery)
Heap Blocks: exact=107
-> Bitmap Index Scan on jr_vodka_idx (actual time=0.077..0.077 rows=185 loops=1)
Index Cond: (jr @@ '"similar_product_ids" && ["B000089778"]'::jsquery)
Execution time: 0.237 ms (0.394 ms, GIN jsonb_path_value_idx)
(7 rows)
67. Vodka distilling instructions
• config — configures parameters
• entry tree opclass
• equality operator
• compare — compares entry tree parameters (as in GIN)
• extract value — decompose datum into entries (as in GIN)
• extract query — decompose query into keys:
• operator to scan entry tree
• argument to scan entry tree
• consistent — check if item satisfies query (as in GIN)
• triconsistent — check if item satisfies query in ternary logic (as in GIN)
68. CREATE INDEX … USING VODKA
• Delicious bookmarks, mostly text data
set maintenance_work_mem = '1GB';
List of relations
Schema | Name | Type | Owner | Table | Size | Description
--------+--------------------+-------+----------+-------+---------+-------------
public | jb | table | postgres | | 1374 MB | 1252973 rows
public | jb_value_path_idx | index | postgres | jb | 306 MB | 98769.096
public | jb_gin_idx | index | postgres | jb | 544 MB | 129860.859
public | jb_path_value_idx | index | postgres | jb | 306 MB | 100560.313
public | jb_path_idx | index | postgres | jb | 251 MB | 68880.320
public | jb_vodka_idx | index | postgres | jb | 409 MB | 185362.865
(6 rows)
69. CREATE INDEX … USING VODKA
select count(*) from jb where jb @@ 'tags.#.term = "NYC"';
-------------------------------------------------------------------------------------------
Aggregate (actual time=0.423..0.423 rows=1 loops=1)
-> Bitmap Heap Scan on jb (actual time=0.146..0.404 rows=285 loops=1)
Recheck Cond: (jb @@ '"tags".#."term" = "NYC"'::jsquery)
Heap Blocks: exact=285
-> Bitmap Index Scan on jb_vodka_idx (actual time=0.108..0.108 rows=285 loops=1)
Index Cond: (jb @@ '"tags".#."term" = "NYC"'::jsquery)
Execution time: 0.456 ms (0.634 ms, GIN jsonb_value_path_ops)
select count(*) from jb where jb @@ '*.term = "NYC"';
-------------------------------------------------------------------------------------------
Aggregate (actual time=0.495..0.495 rows=1 loops=1)
-> Bitmap Heap Scan on jb (actual time=0.245..0.474 rows=285 loops=1)
Recheck Cond: (jb @@ '*."term" = "NYC"'::jsquery)
Heap Blocks: exact=285
-> Bitmap Index Scan on jb_vodka_idx (actual time=0.214..0.214 rows=285 loops=1)
Index Cond: (jb @@ '*."term" = "NYC"'::jsquery)
Execution time: 0.526 ms (0.716 ms, GIN jsonb_path_value_ops)
70. CREATE INDEX … USING VODKA
• CITUS data, text and numeric
set maintenance_work_mem = '1GB';
List of relations
Schema | Name | Type | Owner | Table | Size | Description
--------+--------------------+-------+----------+-------+---------+-------------
public | jr | table | postgres | | 1573 MB | 3023162 rows
public | jr_value_path_idx | index | postgres | jr | 196 MB | 79180.120
public | jr_gin_idx | index | postgres | jr | 235 MB | 111814.929
public | jr_path_value_idx | index | postgres | jr | 196 MB | 73369.713
public | jr_path_idx | index | postgres | jr | 180 MB | 48981.307
public | jr_vodka_idx3 | index | postgres | jr | 240 MB | 155714.777
(6 rows)
71. CREATE INDEX … USING VODKA
explain (analyze, costs off) select count(*) from jr where jr @@ ' similar_product_ids && ["B000089778"]';
QUERY PLAN
-------------------------------------------------------------------------------------------
Aggregate (actual time=0.200..0.200 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=0.090..0.183 rows=185 loops=1)
Recheck Cond: (jr @@ '"similar_product_ids" && ["B000089778"]'::jsquery)
Heap Blocks: exact=107
-> Bitmap Index Scan on jr_vodka_idx (actual time=0.077..0.077 rows=185 loops=1)
Index Cond: (jr @@ '"similar_product_ids" && ["B000089778"]'::jsquery)
Execution time: 0.237 ms (0.394 ms, GIN jsonb_path_value_idx)
(7 rows)
72. CREATE INDEX … USING VODKA
• No statistics, no planning :(
select count(*) from jr where jr @@ ' similar_product_ids && ["B000089778"]
& product_sales_rank( $ > 10000 & $ < 20000)';
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Aggregate (actual time=127.471..127.471 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=127.416..127.461 rows=45 loops=1)
Recheck Cond: (jr @@ '("similar_product_ids" && ["B000089778"]
& "product_sales_rank"($ > 10000 & $ < 20000))'::jsquery)
Heap Blocks: exact=45
-> Bitmap Index Scan on jr_vodka_idx (actual time=127.400..127.400 rows=45 loops=1)
Index Cond: (jr @@ '("similar_product_ids" && ["B000089778"]
& "product_sales_rank"($ > 10000 & $ < 20000))'::jsquery)
Execution time: 130.051 ms
(7 rows)
73. CREATE INDEX … USING VODKA
• No statistics, no planning :(
select count(*) from jr where jr @@ ' similar_product_ids && ["B000089778"]'
and (jr->>'product_sales_rank')::int>10000 and (jr->>'product_sales_rank')::int<20000;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------
Aggregate (actual time=0.401..0.401 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=0.109..0.395 rows=45 loops=1)
Recheck Cond: (jr @@ '"similar_product_ids" && ["B000089778"]'::jsquery)
Filter: ((((jr ->> 'product_sales_rank'::text))::integer > 10000)
AND (((jr ->> 'product_sales_rank'::text))::integer < 20000))
Rows Removed by Filter: 140
Heap Blocks: exact=107
-> Bitmap Index Scan on jr_vodka_idx (actual time=0.079..0.079 rows=185 loops=1)
Index Cond: (jr @@ '"similar_product_ids" && ["B000089778"]'::jsquery)
Execution time: 0.431 ms (7 ms, MongoDB)
(9 rows)
BIG Potential !
74. CREATE INDEX … USING VODKA
select count(*) from jr where jr @@ 'similar_product_ids && ["B000089778"] & review_rating($> 3 & $<5)';
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------
Aggregate (actual time=98.313..98.314 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=98.273..98.307 rows=32 loops=1)
Recheck Cond: (jr @@ '("similar_product_ids" && ["B000089778"] & "review_rating"($ > 3 & $ < 5))'::jsquery)
Heap Blocks: exact=16
-> Bitmap Index Scan on jr_path_value_idx (actual time=98.254..98.254 rows=32 loops=1)
Index Cond: (jr @@ '("similar_product_ids" && ["B000089778"] & "review_rating"($ > 3 & $ < 5))'::jsquery)
Execution time: 99.873 ms
-------------------------------------------------------------------------------------------------------------------------
Aggregate (actual time=1.521..1.521 rows=1 loops=1)
-> Bitmap Heap Scan on jr (actual time=1.503..1.515 rows=32 loops=1)
Recheck Cond: (jr @@ '("similar_product_ids" && ["B000089778"] & "review_rating"($ > 3 & $ < 5))'::jsquery)
Heap Blocks: exact=16
-> Bitmap Index Scan on jr_vodka_idx (actual time=1.498..1.498 rows=32 loops=1)
Index Cond: (jr @@ '("similar_product_ids" && ["B000089778"] & "review_rating"($ > 3 & $ < 5))'::jsquery)
Execution time: 1.550 ms (FAST SCAN !)
75. Need positional information for both GIN
and VODKA
# explain analyze select * from test where v @@ '#(f1 = 10 & f2 = 20)'; - HUGE RECHECK!
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------
Bitmap Heap Scan on test (cost=191.75..3812.68 rows=1000 width=32)
(actual time=14.576..35.039 rows=1005 loops=1)
Recheck Cond: (v @@ '#("f1" = 10 & "f2" = 20)'::jsquery)
Rows Removed by Index Recheck: 7998
Heap Blocks: exact=8416
-> Bitmap Index Scan on test_idx (cost=0.00..191.50 rows=1000 width=0)
(actual time=13.396..13.396 rows=9003 loops=1)
Index Cond: (v @@ '#("f1" = 10 & "f2" = 20)'::jsquery)
Execution time: 35.329 ms
83. Rtree Vodka
• R-tree based on GiST as Entry tree
• An algorithm for covering polygons with rectangles ?
• Need support — POSTGIS ?
84. New VODKA concept
• Posting list/tree is just a way of
effective duplicate storage
• Entry tree can consist of
multiple levels of different
access methods
• VODKA is a way to combine
different access method in
single index: VODKA
CONNECTING INDEXES
85. Summary
• jsonb in core in 9.4, jsquery extension for 9.4
• jsonb querying problems are identified
• Proposal for bringing jsonb querying at SQL-level
• VODKA as a new level of access method extendability (have a prototype
and new concept)
• New VODKA concept
• Extendable AMs + Generalized WAL prototype (ability to release VODKA
as an extension)
86. We invite to PGConf.RU in Moscow,
February 2015!