SlideShare a Scribd company logo
1 of 84
Download to read offline
The NoSQL Store everyoneThe NoSQL Store everyone
ignores: PostgreSQLignores: PostgreSQL
Stephan Hochdörfer // 04-06-2015
About meAbout me
Stephan Hochdörfer
Head of Technology, bitExpert AG
(Mannheim, Germany)
S.Hochdoerfer@bitExpert.de
@shochdoerfer
#PHP, #DevOps, #Automation, #unKonf
End of relational databases?End of relational databases?
Freedom of NoSQL?Freedom of NoSQL?
NoSQL DatabasesNoSQL Databases
NoSQL Database TypesNoSQL Database Types
Graph Database
Object Database
Column Store
Key-Value Store
Document Store
Schemaless?Schemaless?
Schema changes
can be expensive
Can speed up
Development
Can help with
Continuous Delivery
Schemaless does not
mean unstructured!
PostgreSQL as the "glue"PostgreSQL as the "glue"
Peaceful coexistence...Peaceful coexistence...
Store documents in a
document-oriented fashion
Store relational data
in a relational schema
...but choose wisely...but choose wisely
Postgres DatatypesPostgres Datatypes
"Schemaless" datatypes:
Array
hstore
JSON / JSONb
XML
ArrayArray
« [...] PostgreSQL allows columns of a table to be
defined as variable-length multidimensional arrays. »
- PostgreSQL documentation
Create array columnCreate array column
CREATE TABLE blogposts (
title text,
content text,
tags text[]
);
Multidimensional array FTW!Multidimensional array FTW!
CREATE TABLE tictactoe (
squares integer[3][3]
);
Insert arrayInsert array
INSERT INTO blogposts VALUES (
'Mein Blogpost',
'Lorem ipsum...',
ARRAY['lorem', 'ipsum', 'blogpost']
);
INSERT INTO blogposts VALUES (
'Mein zweiter Blogpost',
'Lorem ipsum...',
ARRAY['lorem', 'ipsum']
);
Insert arrayInsert array
INSERT INTO blogposts VALUES (
'Mein Blogpost',
'Lorem ipsum...',
'{"lorem", "ipsum", "blogpost"}'
);
INSERT INTO blogposts VALUES (
'Mein zweiter Blogpost',
'Lorem ipsum...',
'{"lorem", "ipsum"}'
);
Accessing array elementsAccessing array elements
SELECT tags[3] FROM blogposts;
tags
----------
blogpost
(2 rows)
Filtering arraysFiltering arrays
SELECT * from blogposts WHERE tags[2] = 'ipsum';
title | content | tags
-----------------------+----------------+------------------------
Mein Blogpost | Lorem ipsum... | {lorem,ipsum,blogpost}
Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum}
(2 rows)
Filtering arraysFiltering arrays
SELECT * FROM blogposts WHERE 'blogpost' = ANY(tags);
title | content | tags
---------------+----------------+------------------------
Mein Blogpost | Lorem ipsum... | {lorem,ipsum,blogpost}
(1 row)
Filtering arraysFiltering arrays
SELECT * FROM blogposts WHERE tags && ARRAY['lorem', 'blogpost'];
title | content | tags
-----------------------+----------------+------------------------
Mein Blogpost | Lorem ipsum... | {lorem,ipsum,blogpost}
Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum}
(2 rows)
Filtering arraysFiltering arrays
SELECT * FROM blogposts WHERE tags @> ARRAY['lorem', 'blogpost']
title | content | tags
---------------+----------------+------------------------
Mein Blogpost | Lorem ipsum... | {lorem,ipsum,blogpost}
(1 row)
Generating a tag cloudGenerating a tag cloud
SELECT UNNEST(tags) as tag, COUNT(*) as cnt FROM blogposts
GROUP BY tag;
tag | cnt
----------+-----
blogpost | 1
lorem | 2
ipsum | 2
(3 rows)
Dealing with indexesDealing with indexes
CREATE INDEX tags_idx on "blogposts" USING GIN ("tags");
SET enable_seqscan TO off;
EXPLAIN ANALYZE SELECT * FROM blogposts WHERE tags @> ARRAY['tag3'];
QUERY PLAN
--------------------------------------------------------------------
Bitmap Heap Scan on blogposts (cost=8.00..12.01 rows=1 width=96) (actual time=0.0
Recheck Cond: (tags @> '{tag3}'::text[])
-> Bitmap Index Scan on tags_idx (cost=0.00..8.00 rows=1 width=0) (actual time
Index Cond: (tags @> '{tag3}'::text[])
Total runtime: 0.131 ms
(5 rows)
Updating arraysUpdating arrays
UPDATE blogposts SET tags = ARRAY['tag1', 'tag2', 'blogpost']
WHERE title = 'Mein Blogpost';
SELECT * FROM blogposts;
title | content | tags
-----------------------+----------------+----------------------
Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum}
Mein Blogpost | Lorem ipsum... | {tag1,tag2,blogpost}
(2 rows)
Updating single array itemUpdating single array item
UPDATE blogposts SET tags[3] = 'tag3' WHERE title = 'Mein Blogpost';
SELECT * FROM blogposts;
title | content | tags
-----------------------+----------------+------------------
Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum}
Mein Blogpost | Lorem ipsum... | {tag1,tag2,tag3}
(2 rows)
Updating single array itemUpdating single array item
UPDATE blogposts SET tags[5] = 'tag6' WHERE title = 'Mein Blogpost';
SELECT * FROM blogposts;
title | content | tags
-----------------------+----------------+----------------------------
Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum}
Mein Blogpost | Lorem ipsum... | {tag1,tag2,tag3,NULL,tag6}
(2 rows)
Partial array updatePartial array update
UPDATE blogposts SET tags[4:5] = ARRAY['tag4', 'tag5']
WHERE title = 'Mein Blogpost';
title | content | tags
-----------------------+----------------+----------------------------
Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum}
Mein Blogpost | Lorem ipsum... | {tag1,tag2,tag3,tag4,tag5}
(2 rows)
Array functionsArray functions
array_dims()
array_upper()
array_lower()
array_length()
array_prepend()
array_append()
...
hstorehstore
« [...] data type for storing sets of key/value pairs within a single
PostgreSQL value. [...] Keys and values are simply text strings.
» - PostgreSQL documentation
Install hstore extensionInstall hstore extension
CREATE EXTENSION hstore;
Create hstore columnCreate hstore column
CREATE TABLE products (
name text,
price float,
description text,
metadata hstore
);
Insert hstore datasetInsert hstore dataset
INSERT INTO products VALUES (
'Product A',
123.3,
'Lorem ipsum',
'color => black, weight => 3kg'::hstore
);
INSERT INTO products VALUES (
'Product B',
45.0,
'Lorem ipsum',
'color => red'::hstore
);
Filtering hstore datasetFiltering hstore dataset
SELECT metadata->'color' FROM products;
?column?
----------
black
red
(2 rows)
Filtering hstore datasetFiltering hstore dataset
SELECT metadata->'weight' FROM products;
?column?
----------
3kg
(2 rows)
Search for a key in hstoreSearch for a key in hstore
SELECT * FROM products WHERE metadata ? 'weight';
name | price | description | metadata
-----------+-------+-------------+-----------------------------------
Product A | 123.3 | Lorem ipsum | "color"=>"black", "weight"=>"3kg"
(1 row)
Search for key/value in hstoreSearch for key/value in hstore
SELECT * FROM products WHERE metadata @> 'color => red';
name | price | description | metadata
-----------+-------+-------------+----------------
Product B | 45 | Lorem ipsum | "color"=>"red"
(1 row)
Query for all hstore keysQuery for all hstore keys
SELECT DISTINCT UNNEST(AKEYS(metadata)) as keys FROM products;
keys
--------
weight
color
(2 rows)
Dealing with indexesDealing with indexes
CREATE INDEX metadata_idx ON products USING GIN (metadata);
EXPLAIN ANALYZE SELECT * FROM products WHERE metadata @>
'color => red';
QUERY PLAN
---------------------------------------------------------------------
Bitmap Heap Scan on products (cost=12.00..16.01 rows=1 width=104) (actual time=0.
Recheck Cond: (metadata @> '"color"=>"red"'::hstore)
-> Bitmap Index Scan on metadata_idx (cost=0.00..12.00 rows=1 width=0) (actual
Index Cond: (metadata @> '"color"=>"red"'::hstore)
Total runtime: 0.100 ms
(5 rows)
Updating hstore datasetUpdating hstore dataset
UPDATE products SET metadata = 'color => black, weight => 5kg'::hstore WHERE name =
Partial hstore dataset updatePartial hstore dataset update
UPDATE products SET metadata = metadata || 'weight => 1kg'::hstore WHERE name = 'Pr
Removing item from hstoreRemoving item from hstore
UPDATE products SET metadata = metadata - 'weight'::text;
hstore functionshstore functions
akeys()
avals()
hstore_to_array()
hstore_to_json()
...
hstore Example: Auditinghstore Example: Auditing
CREATE TABLE audit
(
change_date timestamptz default now(),
before hstore,
after hstore
);
create function audit()
returns trigger
language plpgsql
as $$
begin
INSERT INTO audit(before, after)
SELECT hstore(old), hstore(new);
return new;
end;
$$;
hstore Example: Auditinghstore Example: Auditing
create trigger audit
after update on example
for each row
execute procedure audit();
select change_date, after - before as diff from audit;
change_date | diff
-------------------------------+-----------
2013-11-08 09:29:19.808217+02 | "f1"=>"b"
2013-11-08 09:29:19.808217+02 | "f2"=>"c"
(2 rows)
Source: Auditing Changes with Hstore
JSONJSON
« [...] the json data type has the advantage of checking
that each stored value is a valid JSON value. »
- PostgreSQL documentation
Create JSON columnCreate JSON column
CREATE TABLE products (
name text,
price float,
description text,
metadata json
);
Insert JSON documentInsert JSON document
INSERT INTO products VALUES (
'Product A',
123.3,
'Lorem ipsum',
' { "color": "black", "weight": "3kg" } '
);
INSERT INTO products VALUES (
'Product B',
45.0,
'Lorem ipsum',
' { "color": "red" } '
);
Insert JSON documentInsert JSON document
INSERT INTO products VALUES (
'Product C',
9.95,
'Lorem ipsum',
' { "color": ["red", "green", "blue"] } '
);
Insert JSON documentInsert JSON document
INSERT INTO products VALUES (
'Product D',
9.95,
'Lorem ipsum',
' { "color": ["red", "green", "blue", ] } '
);
ERROR: invalid input syntax for type json
LINE 5: ' { "color": ["red", "green", "blue", ] } '
^
DETAIL: Expected JSON value, but found "]".
CONTEXT: JSON data, line 1: { "color": ["red", "green", "blue", ]...
Filtering JSON documentFiltering JSON document
SELECT metadata->>'color' FROM products;
?column?
--------------------------
black
red
["red", "green", "blue"]
(3 rows)
Filtering JSON documentFiltering JSON document
SELECT metadata#>'{color, 2}' FROM products;
?column?
----------
"blue"
(3 rows)
Dealing with indexesDealing with indexes
CREATE UNIQUE INDEX product_color ON products((metadata->>'color'));
INSERT INTO products VALUES (
'Product D',
21.95,
'Lorem ipsum',
' { "color": "red" } '
);
ERROR: duplicate key value violates unique constraint "product_color"
DETAIL: Key ((metadata ->> 'color'::text))=(red) already exists.
Updating JSON documentUpdating JSON document
UPDATE products SET metadata = ' { "color": ["red", "green", "blue", "yellow"] } '
JSON functionsJSON functions
array_to_json()
row_to_json()
json_array_length()
json_object_keys()
...
Micro-JSON WebserviceMicro-JSON Webservice
SELECT row_to_json(products) FROM products WHERE name = 'Product C';
row_to_json
---------------------------------------------------------------------
{"name":"Product C","price":9.95,"description":"Lorem ipsum","metadata": { "color"
(1 row)
Micro-JSON WebserviceMicro-JSON Webservice
SELECT row_to_json(t)
FROM (
SELECT name, price FROM products WHERE name = 'Product C'
) t;
row_to_json
-----------------------------------
{"name":"Product C","price":9.95}
(1 row)
JSONbJSONb
« There are two JSON data types: json and jsonb [...]
The major practical difference is one of efficiency. »
- PostgreSQL documentation
Create JSONb columnCreate JSONb column
CREATE TABLE products (
name text,
price float,
description text,
metadata jsonb
);
Insert JSON documentInsert JSON document
INSERT INTO products VALUES (
'Product A',
123.3,
'Lorem ipsum',
' { "color": "black", "weight": "3kg" } '
);
INSERT INTO products VALUES (
'Product B',
45.0,
'Lorem ipsum',
' { "color": "red" } '
);
Insert JSON documentInsert JSON document
INSERT INTO products VALUES (
'Product D',
9.95,
'Lorem ipsum',
' { "color": ["red", "green", "blue", ] } '
);
ERROR: invalid input syntax for type json
LINE 5: ' { "color": ["red", "green", "blue", ] } '
^
DETAIL: Expected JSON value, but found "]".
CONTEXT: JSON data, line 1: { "color": ["red", "green", "blue", ]...
Dealing with indexesDealing with indexes
CREATE INDEX metadata_idx ON products USING gin (metadata);
Search for key/value in JSONSearch for key/value in JSON
SELECT * FROM products WHERE metadata @> '{"color": "black"}';
name | price | description | metadata
------------+---------+-----------------+----------------------------
Product A | 123.3 | Lorem ipsum | {"color": "black", "weight": "3kg"}
(1 row)
Search for key/value in JSONSearch for key/value in JSON
EXPLAIN ANALYZE SELECT * FROM products WHERE metadata @> '{"color": "black"}';
QUERY PLAN
--------------------------------------------------------------------
Bitmap Heap Scan on products (cost=12.00..16.01 rows=1 width=104) (actual time=0.
Recheck Cond: (metadata @> '{"color": "black"}'::jsonb)
Heap Blocks: exact=1
-> Bitmap Index Scan on metadata_idx (cost=0.00..12.00 rows=1 width=0) (actual
Index Cond: (metadata @> '{"color": "black"}'::jsonb)
Planning time: 0.131 ms
Execution time: 0.105 ms
JSON key lookupJSON key lookup
SELECT * FROM products WHERE metadata ? 'weight';
name | price | description | metadata
------------+---------+-----------------+----------------------------
Product A | 123.3 | Lorem ipsum | {"color": "black", "weight": "3kg"}
(1 row)
JSON key lookupJSON key lookup
SELECT * FROM products WHERE metadata ?| array['weight', 'color'];
name | price | description | metadata
------------+---------+-----------------+----------------------------
Product A | 123.3 | Lorem ipsum | {"color": "black", "weight": "3kg"}
Product B | 45 | Lorem ipsum | {"color": "red"}
JSON keys lookupJSON keys lookup
SELECT * FROM products WHERE metadata ?& array['weight', 'color'];
name | price | description | metadata
------------+---------+-----------------+----------------------------
Product A | 123.3 | Lorem ipsum | {"color": "black", "weight": "3kg"}
(1 row)
JSON vs. JSONbJSON vs. JSONb
Use JSONb for complex
operations
JSONb needs more
disk space than JSON
Use JSON just for storage
Use JSON when you need
to keep the structure
XMLXML
« [...] it checks the input values for well-formedness, and there
are support functions to perform type-safe operations on it. » -
PostgreSQL documentation
Create XML columnCreate XML column
CREATE TABLE imports (
importDate date,
content XML
);
Insert XML documentInsert XML document
INSERT INTO imports VALUES (
'2014-04-05',
'<?xml version="1.0"?>
<order customer="4711">
<product id="1234">10</product>
<product id="9876">50</product>
</order>'::xml
);
INSERT INTO imports VALUES (
'2014-04-05',
'<?xml version="1.0"?>
<order customer="5432">
<product id="1234">3</product>
</order>'::xml
);
Insert XML documentInsert XML document
INSERT INTO imports VALUES (
'2014-04-05',
'<?xml version="1.0"?>
<open></close>'::xml
);
ERROR: invalid XML content
LINE 3: '<?xml version="1.0"?>
^
DETAIL: line 2: Opening and ending tag mismatch: open line 2 and close
<open></close>
^
line 2: chunk is not well balanced
<open></close>
^
Filtering XML documentFiltering XML document
SELECT xpath('/order/product/@id', content) FROM imports;
xpath
-------------
{1234,9876}
{1234}
(2 rows)
Filtering XML documentFiltering XML document
SELECT UNNEST(xpath('/order/product/@id', content)::text[])
as productid, COUNT(*) as orders FROM imports GROUP BY productid;
productid | orders
-----------+--------
9876 | 1
1234 | 2
(2 rows)
Search in XML documentSearch in XML document
SELECT * FROM imports WHERE xpath_exists('/order/product[@id=9876]', content);
importdate | content
------------+---------------------------------
2014-04-05 | <order customer="4711"> +
| <product id="1234">10</product>+
| <product id="9876">50</product>+
| </order>
(1 row)
Create XML documentCreate XML document
SELECT query_to_xml('SELECT * FROM products', true, false, '') as product;
product
--------------------------------------------------------------------
<table xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +
+
<row> +
<name>Product A</name> +
<price>123.3</price> +
<description>Lorem ipsum</description> +
<metadata> { "color": "black", "weight": "3kg" } </metadata> +
</row> +
+
</table> +
(1 row)
XML functionsXML functions
xmlconcat()
xmlforest()
xmlagg()
xml_is_well_formed()
query_to_xml()
xpath()
...
Partition database tablesPartition database tables
« [...] Partitioning refers to splitting what is logically
one large table into smaller physical pieces. »
- PostgreSQL documentation
Partition database tablesPartition database tables
CREATE TABLE sales_stats (
year int,
product text,
sales_by_quarter hstore
);
CREATE TABLE sales_stats_2012(
CHECK ( year = 2012 )
) INHERITS (sales_stats);
CREATE TABLE sales_stats_2011(
CHECK ( year = 2011 )
) INHERITS (sales_stats);
Partition database tablesPartition database tables
CREATE OR REPLACE FUNCTION sales_stats_part()
RETURNS TRIGGER AS
$BODY$
DECLARE
_new_time int;
_tablename text;
_year text;
_result record;
BEGIN
_new_time := ((NEW."time"/86400)::int)*86400;
_year := to_char(to_timestamp(_new_time), 'YYYY');
_tablename := 'sales_stats_'||_year;
PERFORM 1
FROM pg_catalog.pg_class c
JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind = 'r' AND c.relname = _tablename;
Partition database tablesPartition database tables
IF NOT FOUND THEN
EXECUTE 'CREATE TABLE ' || quote_ident(_tablename) || ' (
CHECK ( year = ' || quote_literal(_year) || '))
) INHERITS (sales_stats)';
END IF;
EXECUTE 'INSERT INTO ' || quote_ident(_tablename) || ' VALUES ($1.*)' USING NEW;
RETURN NULL;
END;
$BODY$
LANGUAGE plpgsql;
CREATE TRIGGER sales_stats_trigger
BEFORE INSERT ON sales_stats
FOR EACH ROW EXECUTE PROCEDURE sales_stats_part();
To infinity and beyond!To infinity and beyond!
Foreign Data Wrappers
Range datatype
Materialized views
Conditional Indexes
...
Large ecosystemLarge ecosystem
PostgreSQL usersPostgreSQL users
Thank you!

More Related Content

What's hot

NoSQL для PostgreSQL: Jsquery — язык запросов
NoSQL для PostgreSQL: Jsquery — язык запросовNoSQL для PostgreSQL: Jsquery — язык запросов
NoSQL для PostgreSQL: Jsquery — язык запросовCodeFest
 
Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)MongoDB
 
Big Data Everywhere Chicago: Unleash the Power of HBase Shell (Conversant)
Big Data Everywhere Chicago: Unleash the Power of HBase Shell (Conversant) Big Data Everywhere Chicago: Unleash the Power of HBase Shell (Conversant)
Big Data Everywhere Chicago: Unleash the Power of HBase Shell (Conversant) BigDataEverywhere
 
PostgreSQL Moscow Meetup - September 2014 - Oleg Bartunov and Alexander Korotkov
PostgreSQL Moscow Meetup - September 2014 - Oleg Bartunov and Alexander KorotkovPostgreSQL Moscow Meetup - September 2014 - Oleg Bartunov and Alexander Korotkov
PostgreSQL Moscow Meetup - September 2014 - Oleg Bartunov and Alexander KorotkovNikolay Samokhvalov
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineJason Terpko
 
Advanced pg_stat_statements: Filtering, Regression Testing & more
Advanced pg_stat_statements: Filtering, Regression Testing & moreAdvanced pg_stat_statements: Filtering, Regression Testing & more
Advanced pg_stat_statements: Filtering, Regression Testing & moreLukas Fittl
 
CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...
CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...
CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...DataStax
 
Postgres performance for humans
Postgres performance for humansPostgres performance for humans
Postgres performance for humansCraig Kerstiens
 
Indexing and Query Optimization
Indexing and Query OptimizationIndexing and Query Optimization
Indexing and Query OptimizationMongoDB
 
ClickHouse Features for Advanced Users, by Aleksei Milovidov
ClickHouse Features for Advanced Users, by Aleksei MilovidovClickHouse Features for Advanced Users, by Aleksei Milovidov
ClickHouse Features for Advanced Users, by Aleksei MilovidovAltinity Ltd
 
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEOTricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEOAltinity Ltd
 
Should I Use Scalding or Scoobi or Scrunch?
Should I Use Scalding or Scoobi or Scrunch? Should I Use Scalding or Scoobi or Scrunch?
Should I Use Scalding or Scoobi or Scrunch? DataWorks Summit
 
PostgreSQL: Data analysis and analytics
PostgreSQL: Data analysis and analyticsPostgreSQL: Data analysis and analytics
PostgreSQL: Data analysis and analyticsHans-Jürgen Schönig
 
Deep dive to PostgreSQL Indexes
Deep dive to PostgreSQL IndexesDeep dive to PostgreSQL Indexes
Deep dive to PostgreSQL IndexesIbrar Ahmed
 
Mongo db勉強会20110730
Mongo db勉強会20110730Mongo db勉強会20110730
Mongo db勉強会20110730Akihiro Okuno
 
MongoDB Aggregation
MongoDB Aggregation MongoDB Aggregation
MongoDB Aggregation Amit Ghosh
 
ClickHouse Unleashed 2020: Our Favorite New Features for Your Analytical Appl...
ClickHouse Unleashed 2020: Our Favorite New Features for Your Analytical Appl...ClickHouse Unleashed 2020: Our Favorite New Features for Your Analytical Appl...
ClickHouse Unleashed 2020: Our Favorite New Features for Your Analytical Appl...Altinity Ltd
 
Getting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NETGetting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NETTomas Jansson
 

What's hot (20)

Full Text Search In PostgreSQL
Full Text Search In PostgreSQLFull Text Search In PostgreSQL
Full Text Search In PostgreSQL
 
NoSQL для PostgreSQL: Jsquery — язык запросов
NoSQL для PostgreSQL: Jsquery — язык запросовNoSQL для PostgreSQL: Jsquery — язык запросов
NoSQL для PostgreSQL: Jsquery — язык запросов
 
Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)
 
Big Data Everywhere Chicago: Unleash the Power of HBase Shell (Conversant)
Big Data Everywhere Chicago: Unleash the Power of HBase Shell (Conversant) Big Data Everywhere Chicago: Unleash the Power of HBase Shell (Conversant)
Big Data Everywhere Chicago: Unleash the Power of HBase Shell (Conversant)
 
PostgreSQL Moscow Meetup - September 2014 - Oleg Bartunov and Alexander Korotkov
PostgreSQL Moscow Meetup - September 2014 - Oleg Bartunov and Alexander KorotkovPostgreSQL Moscow Meetup - September 2014 - Oleg Bartunov and Alexander Korotkov
PostgreSQL Moscow Meetup - September 2014 - Oleg Bartunov and Alexander Korotkov
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation Pipeline
 
Advanced pg_stat_statements: Filtering, Regression Testing & more
Advanced pg_stat_statements: Filtering, Regression Testing & moreAdvanced pg_stat_statements: Filtering, Regression Testing & more
Advanced pg_stat_statements: Filtering, Regression Testing & more
 
CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...
CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...
CQL performance with Apache Cassandra 3.0 (Aaron Morton, The Last Pickle) | C...
 
Postgres performance for humans
Postgres performance for humansPostgres performance for humans
Postgres performance for humans
 
Indexing and Query Optimization
Indexing and Query OptimizationIndexing and Query Optimization
Indexing and Query Optimization
 
ClickHouse Features for Advanced Users, by Aleksei Milovidov
ClickHouse Features for Advanced Users, by Aleksei MilovidovClickHouse Features for Advanced Users, by Aleksei Milovidov
ClickHouse Features for Advanced Users, by Aleksei Milovidov
 
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEOTricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
 
Should I Use Scalding or Scoobi or Scrunch?
Should I Use Scalding or Scoobi or Scrunch? Should I Use Scalding or Scoobi or Scrunch?
Should I Use Scalding or Scoobi or Scrunch?
 
PostgreSQL: Data analysis and analytics
PostgreSQL: Data analysis and analyticsPostgreSQL: Data analysis and analytics
PostgreSQL: Data analysis and analytics
 
Deep dive to PostgreSQL Indexes
Deep dive to PostgreSQL IndexesDeep dive to PostgreSQL Indexes
Deep dive to PostgreSQL Indexes
 
Mongo db勉強会20110730
Mongo db勉強会20110730Mongo db勉強会20110730
Mongo db勉強会20110730
 
MongoDB Aggregation
MongoDB Aggregation MongoDB Aggregation
MongoDB Aggregation
 
MongoDB-SESSION03
MongoDB-SESSION03MongoDB-SESSION03
MongoDB-SESSION03
 
ClickHouse Unleashed 2020: Our Favorite New Features for Your Analytical Appl...
ClickHouse Unleashed 2020: Our Favorite New Features for Your Analytical Appl...ClickHouse Unleashed 2020: Our Favorite New Features for Your Analytical Appl...
ClickHouse Unleashed 2020: Our Favorite New Features for Your Analytical Appl...
 
Getting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NETGetting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NET
 

Similar to Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matters Dublin 2015

Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)Ontico
 
PerlApp2Postgresql (2)
PerlApp2Postgresql (2)PerlApp2Postgresql (2)
PerlApp2Postgresql (2)Jerome Eteve
 
Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutesJos Dirksen
 
Hadoop Integration in Cassandra
Hadoop Integration in CassandraHadoop Integration in Cassandra
Hadoop Integration in CassandraJairam Chandar
 
PostgreSQL Modules Tutorial - chkpass, hstore, fuzzystrmach, isn
PostgreSQL Modules Tutorial - chkpass, hstore, fuzzystrmach, isn PostgreSQL Modules Tutorial - chkpass, hstore, fuzzystrmach, isn
PostgreSQL Modules Tutorial - chkpass, hstore, fuzzystrmach, isn Sagar Arlekar
 
The NoSQL store everyone ignored
The NoSQL store everyone ignoredThe NoSQL store everyone ignored
The NoSQL store everyone ignoredZohaib Hassan
 
2015-12-05 Александр Коротков, Иван Панченко - Слабо-структурированные данные...
2015-12-05 Александр Коротков, Иван Панченко - Слабо-структурированные данные...2015-12-05 Александр Коротков, Иван Панченко - Слабо-структурированные данные...
2015-12-05 Александр Коротков, Иван Панченко - Слабо-структурированные данные...HappyDev
 
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...Databricks
 
Работа с документами в JavaScript
Работа с документами в JavaScriptРабота с документами в JavaScript
Работа с документами в JavaScriptДмитрий Радыно
 
Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...
Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...
Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...Ontico
 
Heroku Postgres Cloud Database Webinar
Heroku Postgres Cloud Database WebinarHeroku Postgres Cloud Database Webinar
Heroku Postgres Cloud Database WebinarSalesforce Developers
 
The Ring programming language version 1.5.2 book - Part 44 of 181
The Ring programming language version 1.5.2 book - Part 44 of 181The Ring programming language version 1.5.2 book - Part 44 of 181
The Ring programming language version 1.5.2 book - Part 44 of 181Mahmoud Samir Fayed
 
Background Sometimes the standard C libraries (stdio.h, stdlib.h, e.pdf
Background Sometimes the standard C libraries (stdio.h, stdlib.h, e.pdfBackground Sometimes the standard C libraries (stdio.h, stdlib.h, e.pdf
Background Sometimes the standard C libraries (stdio.h, stdlib.h, e.pdfebrahimbadushata00
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
DataCamp Cheat Sheets 4 Python Users (2020)
DataCamp Cheat Sheets 4 Python Users (2020)DataCamp Cheat Sheets 4 Python Users (2020)
DataCamp Cheat Sheets 4 Python Users (2020)EMRE AKCAOGLU
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스PgDay.Seoul
 
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
 Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDBMongoDB
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQLPeter Eisentraut
 

Similar to Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matters Dublin 2015 (20)

Full Text Search in PostgreSQL
Full Text Search in PostgreSQLFull Text Search in PostgreSQL
Full Text Search in PostgreSQL
 
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
 
PerlApp2Postgresql (2)
PerlApp2Postgresql (2)PerlApp2Postgresql (2)
PerlApp2Postgresql (2)
 
Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutes
 
Hadoop Integration in Cassandra
Hadoop Integration in CassandraHadoop Integration in Cassandra
Hadoop Integration in Cassandra
 
PostgreSQL Modules Tutorial - chkpass, hstore, fuzzystrmach, isn
PostgreSQL Modules Tutorial - chkpass, hstore, fuzzystrmach, isn PostgreSQL Modules Tutorial - chkpass, hstore, fuzzystrmach, isn
PostgreSQL Modules Tutorial - chkpass, hstore, fuzzystrmach, isn
 
The NoSQL store everyone ignored
The NoSQL store everyone ignoredThe NoSQL store everyone ignored
The NoSQL store everyone ignored
 
2015-12-05 Александр Коротков, Иван Панченко - Слабо-структурированные данные...
2015-12-05 Александр Коротков, Иван Панченко - Слабо-структурированные данные...2015-12-05 Александр Коротков, Иван Панченко - Слабо-структурированные данные...
2015-12-05 Александр Коротков, Иван Панченко - Слабо-структурированные данные...
 
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...
Spark Machine Learning: Adding Your Own Algorithms and Tools with Holden Kara...
 
greenDAO
greenDAOgreenDAO
greenDAO
 
Работа с документами в JavaScript
Работа с документами в JavaScriptРабота с документами в JavaScript
Работа с документами в JavaScript
 
Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...
Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...
Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...
 
Heroku Postgres Cloud Database Webinar
Heroku Postgres Cloud Database WebinarHeroku Postgres Cloud Database Webinar
Heroku Postgres Cloud Database Webinar
 
The Ring programming language version 1.5.2 book - Part 44 of 181
The Ring programming language version 1.5.2 book - Part 44 of 181The Ring programming language version 1.5.2 book - Part 44 of 181
The Ring programming language version 1.5.2 book - Part 44 of 181
 
Background Sometimes the standard C libraries (stdio.h, stdlib.h, e.pdf
Background Sometimes the standard C libraries (stdio.h, stdlib.h, e.pdfBackground Sometimes the standard C libraries (stdio.h, stdlib.h, e.pdf
Background Sometimes the standard C libraries (stdio.h, stdlib.h, e.pdf
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
DataCamp Cheat Sheets 4 Python Users (2020)
DataCamp Cheat Sheets 4 Python Users (2020)DataCamp Cheat Sheets 4 Python Users (2020)
DataCamp Cheat Sheets 4 Python Users (2020)
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
 
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
 Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
 

More from NoSQLmatters

Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...
Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...
Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...NoSQLmatters
 
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015NoSQLmatters
 
Peter Bakas - Zero to Insights - Real time analytics with Kafka, C*, and Spar...
Peter Bakas - Zero to Insights - Real time analytics with Kafka, C*, and Spar...Peter Bakas - Zero to Insights - Real time analytics with Kafka, C*, and Spar...
Peter Bakas - Zero to Insights - Real time analytics with Kafka, C*, and Spar...NoSQLmatters
 
Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...
Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...
Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...NoSQLmatters
 
Mark Harwood - Building Entity Centric Indexes - NoSQL matters Dublin 2015
Mark Harwood - Building Entity Centric Indexes - NoSQL matters Dublin 2015Mark Harwood - Building Entity Centric Indexes - NoSQL matters Dublin 2015
Mark Harwood - Building Entity Centric Indexes - NoSQL matters Dublin 2015NoSQLmatters
 
Prassnitha Sampath - Real Time Big Data Analytics with Kafka, Storm & HBase -...
Prassnitha Sampath - Real Time Big Data Analytics with Kafka, Storm & HBase -...Prassnitha Sampath - Real Time Big Data Analytics with Kafka, Storm & HBase -...
Prassnitha Sampath - Real Time Big Data Analytics with Kafka, Storm & HBase -...NoSQLmatters
 
Akmal Chaudhri - How to Build Streaming Data Applications: Evaluating the Top...
Akmal Chaudhri - How to Build Streaming Data Applications: Evaluating the Top...Akmal Chaudhri - How to Build Streaming Data Applications: Evaluating the Top...
Akmal Chaudhri - How to Build Streaming Data Applications: Evaluating the Top...NoSQLmatters
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015NoSQLmatters
 
Chris Ward - Understanding databases for distributed docker applications - No...
Chris Ward - Understanding databases for distributed docker applications - No...Chris Ward - Understanding databases for distributed docker applications - No...
Chris Ward - Understanding databases for distributed docker applications - No...NoSQLmatters
 
Philipp Krenn - Host your database in the cloud, they said... - NoSQL matters...
Philipp Krenn - Host your database in the cloud, they said... - NoSQL matters...Philipp Krenn - Host your database in the cloud, they said... - NoSQL matters...
Philipp Krenn - Host your database in the cloud, they said... - NoSQL matters...NoSQLmatters
 
Lucian Precup - Back to the Future: SQL 92 for Elasticsearch? - NoSQL matters...
Lucian Precup - Back to the Future: SQL 92 for Elasticsearch? - NoSQL matters...Lucian Precup - Back to the Future: SQL 92 for Elasticsearch? - NoSQL matters...
Lucian Precup - Back to the Future: SQL 92 for Elasticsearch? - NoSQL matters...NoSQLmatters
 
Bruno Guedes - Hadoop real time for dummies - NoSQL matters Paris 2015
Bruno Guedes - Hadoop real time for dummies - NoSQL matters Paris 2015Bruno Guedes - Hadoop real time for dummies - NoSQL matters Paris 2015
Bruno Guedes - Hadoop real time for dummies - NoSQL matters Paris 2015NoSQLmatters
 
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...NoSQLmatters
 
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...NoSQLmatters
 
David Pilato - Advance search for your legacy application - NoSQL matters Par...
David Pilato - Advance search for your legacy application - NoSQL matters Par...David Pilato - Advance search for your legacy application - NoSQL matters Par...
David Pilato - Advance search for your legacy application - NoSQL matters Par...NoSQLmatters
 
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015NoSQLmatters
 
Gregorry Letribot - Druid at Criteo - NoSQL matters 2015
Gregorry Letribot - Druid at Criteo - NoSQL matters 2015Gregorry Letribot - Druid at Criteo - NoSQL matters 2015
Gregorry Letribot - Druid at Criteo - NoSQL matters 2015NoSQLmatters
 
Michael Hackstein - Polyglot Persistence & Multi-Model NoSQL Databases - NoSQ...
Michael Hackstein - Polyglot Persistence & Multi-Model NoSQL Databases - NoSQ...Michael Hackstein - Polyglot Persistence & Multi-Model NoSQL Databases - NoSQ...
Michael Hackstein - Polyglot Persistence & Multi-Model NoSQL Databases - NoSQ...NoSQLmatters
 
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015NoSQLmatters
 
Alexandre Vasseur - Evolution of Data Architectures: From Hadoop to Data Lake...
Alexandre Vasseur - Evolution of Data Architectures: From Hadoop to Data Lake...Alexandre Vasseur - Evolution of Data Architectures: From Hadoop to Data Lake...
Alexandre Vasseur - Evolution of Data Architectures: From Hadoop to Data Lake...NoSQLmatters
 

More from NoSQLmatters (20)

Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...
Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...
Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...
 
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015
 
Peter Bakas - Zero to Insights - Real time analytics with Kafka, C*, and Spar...
Peter Bakas - Zero to Insights - Real time analytics with Kafka, C*, and Spar...Peter Bakas - Zero to Insights - Real time analytics with Kafka, C*, and Spar...
Peter Bakas - Zero to Insights - Real time analytics with Kafka, C*, and Spar...
 
Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...
Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...
Dan Sullivan - Data Analytics and Text Mining with MongoDB - NoSQL matters Du...
 
Mark Harwood - Building Entity Centric Indexes - NoSQL matters Dublin 2015
Mark Harwood - Building Entity Centric Indexes - NoSQL matters Dublin 2015Mark Harwood - Building Entity Centric Indexes - NoSQL matters Dublin 2015
Mark Harwood - Building Entity Centric Indexes - NoSQL matters Dublin 2015
 
Prassnitha Sampath - Real Time Big Data Analytics with Kafka, Storm & HBase -...
Prassnitha Sampath - Real Time Big Data Analytics with Kafka, Storm & HBase -...Prassnitha Sampath - Real Time Big Data Analytics with Kafka, Storm & HBase -...
Prassnitha Sampath - Real Time Big Data Analytics with Kafka, Storm & HBase -...
 
Akmal Chaudhri - How to Build Streaming Data Applications: Evaluating the Top...
Akmal Chaudhri - How to Build Streaming Data Applications: Evaluating the Top...Akmal Chaudhri - How to Build Streaming Data Applications: Evaluating the Top...
Akmal Chaudhri - How to Build Streaming Data Applications: Evaluating the Top...
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
 
Chris Ward - Understanding databases for distributed docker applications - No...
Chris Ward - Understanding databases for distributed docker applications - No...Chris Ward - Understanding databases for distributed docker applications - No...
Chris Ward - Understanding databases for distributed docker applications - No...
 
Philipp Krenn - Host your database in the cloud, they said... - NoSQL matters...
Philipp Krenn - Host your database in the cloud, they said... - NoSQL matters...Philipp Krenn - Host your database in the cloud, they said... - NoSQL matters...
Philipp Krenn - Host your database in the cloud, they said... - NoSQL matters...
 
Lucian Precup - Back to the Future: SQL 92 for Elasticsearch? - NoSQL matters...
Lucian Precup - Back to the Future: SQL 92 for Elasticsearch? - NoSQL matters...Lucian Precup - Back to the Future: SQL 92 for Elasticsearch? - NoSQL matters...
Lucian Precup - Back to the Future: SQL 92 for Elasticsearch? - NoSQL matters...
 
Bruno Guedes - Hadoop real time for dummies - NoSQL matters Paris 2015
Bruno Guedes - Hadoop real time for dummies - NoSQL matters Paris 2015Bruno Guedes - Hadoop real time for dummies - NoSQL matters Paris 2015
Bruno Guedes - Hadoop real time for dummies - NoSQL matters Paris 2015
 
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
 
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
 
David Pilato - Advance search for your legacy application - NoSQL matters Par...
David Pilato - Advance search for your legacy application - NoSQL matters Par...David Pilato - Advance search for your legacy application - NoSQL matters Par...
David Pilato - Advance search for your legacy application - NoSQL matters Par...
 
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
Tugdual Grall - From SQL to NoSQL in less than 40 min - NoSQL matters Paris 2015
 
Gregorry Letribot - Druid at Criteo - NoSQL matters 2015
Gregorry Letribot - Druid at Criteo - NoSQL matters 2015Gregorry Letribot - Druid at Criteo - NoSQL matters 2015
Gregorry Letribot - Druid at Criteo - NoSQL matters 2015
 
Michael Hackstein - Polyglot Persistence & Multi-Model NoSQL Databases - NoSQ...
Michael Hackstein - Polyglot Persistence & Multi-Model NoSQL Databases - NoSQ...Michael Hackstein - Polyglot Persistence & Multi-Model NoSQL Databases - NoSQ...
Michael Hackstein - Polyglot Persistence & Multi-Model NoSQL Databases - NoSQ...
 
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015
 
Alexandre Vasseur - Evolution of Data Architectures: From Hadoop to Data Lake...
Alexandre Vasseur - Evolution of Data Architectures: From Hadoop to Data Lake...Alexandre Vasseur - Evolution of Data Architectures: From Hadoop to Data Lake...
Alexandre Vasseur - Evolution of Data Architectures: From Hadoop to Data Lake...
 

Recently uploaded

Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAbdelrhman abooda
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一F La
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改atducpo
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxEmmanuel Dauda
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...Pooja Nehwal
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDRafezzaman
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)jennyeacort
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样vhwb25kk
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home ServiceSapana Sha
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 

Recently uploaded (20)

Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptx
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 

Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matters Dublin 2015

  • 1. The NoSQL Store everyoneThe NoSQL Store everyone ignores: PostgreSQLignores: PostgreSQL Stephan Hochdörfer // 04-06-2015
  • 2. About meAbout me Stephan Hochdörfer Head of Technology, bitExpert AG (Mannheim, Germany) S.Hochdoerfer@bitExpert.de @shochdoerfer #PHP, #DevOps, #Automation, #unKonf
  • 3. End of relational databases?End of relational databases?
  • 6. NoSQL Database TypesNoSQL Database Types Graph Database Object Database Column Store Key-Value Store Document Store
  • 7. Schemaless?Schemaless? Schema changes can be expensive Can speed up Development Can help with Continuous Delivery Schemaless does not mean unstructured!
  • 8. PostgreSQL as the "glue"PostgreSQL as the "glue"
  • 9. Peaceful coexistence...Peaceful coexistence... Store documents in a document-oriented fashion Store relational data in a relational schema
  • 10. ...but choose wisely...but choose wisely
  • 11. Postgres DatatypesPostgres Datatypes "Schemaless" datatypes: Array hstore JSON / JSONb XML
  • 12. ArrayArray « [...] PostgreSQL allows columns of a table to be defined as variable-length multidimensional arrays. » - PostgreSQL documentation
  • 13. Create array columnCreate array column CREATE TABLE blogposts ( title text, content text, tags text[] );
  • 14. Multidimensional array FTW!Multidimensional array FTW! CREATE TABLE tictactoe ( squares integer[3][3] );
  • 15. Insert arrayInsert array INSERT INTO blogposts VALUES ( 'Mein Blogpost', 'Lorem ipsum...', ARRAY['lorem', 'ipsum', 'blogpost'] ); INSERT INTO blogposts VALUES ( 'Mein zweiter Blogpost', 'Lorem ipsum...', ARRAY['lorem', 'ipsum'] );
  • 16. Insert arrayInsert array INSERT INTO blogposts VALUES ( 'Mein Blogpost', 'Lorem ipsum...', '{"lorem", "ipsum", "blogpost"}' ); INSERT INTO blogposts VALUES ( 'Mein zweiter Blogpost', 'Lorem ipsum...', '{"lorem", "ipsum"}' );
  • 17. Accessing array elementsAccessing array elements SELECT tags[3] FROM blogposts; tags ---------- blogpost (2 rows)
  • 18. Filtering arraysFiltering arrays SELECT * from blogposts WHERE tags[2] = 'ipsum'; title | content | tags -----------------------+----------------+------------------------ Mein Blogpost | Lorem ipsum... | {lorem,ipsum,blogpost} Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum} (2 rows)
  • 19. Filtering arraysFiltering arrays SELECT * FROM blogposts WHERE 'blogpost' = ANY(tags); title | content | tags ---------------+----------------+------------------------ Mein Blogpost | Lorem ipsum... | {lorem,ipsum,blogpost} (1 row)
  • 20. Filtering arraysFiltering arrays SELECT * FROM blogposts WHERE tags && ARRAY['lorem', 'blogpost']; title | content | tags -----------------------+----------------+------------------------ Mein Blogpost | Lorem ipsum... | {lorem,ipsum,blogpost} Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum} (2 rows)
  • 21. Filtering arraysFiltering arrays SELECT * FROM blogposts WHERE tags @> ARRAY['lorem', 'blogpost'] title | content | tags ---------------+----------------+------------------------ Mein Blogpost | Lorem ipsum... | {lorem,ipsum,blogpost} (1 row)
  • 22. Generating a tag cloudGenerating a tag cloud SELECT UNNEST(tags) as tag, COUNT(*) as cnt FROM blogposts GROUP BY tag; tag | cnt ----------+----- blogpost | 1 lorem | 2 ipsum | 2 (3 rows)
  • 23. Dealing with indexesDealing with indexes CREATE INDEX tags_idx on "blogposts" USING GIN ("tags"); SET enable_seqscan TO off; EXPLAIN ANALYZE SELECT * FROM blogposts WHERE tags @> ARRAY['tag3']; QUERY PLAN -------------------------------------------------------------------- Bitmap Heap Scan on blogposts (cost=8.00..12.01 rows=1 width=96) (actual time=0.0 Recheck Cond: (tags @> '{tag3}'::text[]) -> Bitmap Index Scan on tags_idx (cost=0.00..8.00 rows=1 width=0) (actual time Index Cond: (tags @> '{tag3}'::text[]) Total runtime: 0.131 ms (5 rows)
  • 24. Updating arraysUpdating arrays UPDATE blogposts SET tags = ARRAY['tag1', 'tag2', 'blogpost'] WHERE title = 'Mein Blogpost'; SELECT * FROM blogposts; title | content | tags -----------------------+----------------+---------------------- Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum} Mein Blogpost | Lorem ipsum... | {tag1,tag2,blogpost} (2 rows)
  • 25. Updating single array itemUpdating single array item UPDATE blogposts SET tags[3] = 'tag3' WHERE title = 'Mein Blogpost'; SELECT * FROM blogposts; title | content | tags -----------------------+----------------+------------------ Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum} Mein Blogpost | Lorem ipsum... | {tag1,tag2,tag3} (2 rows)
  • 26. Updating single array itemUpdating single array item UPDATE blogposts SET tags[5] = 'tag6' WHERE title = 'Mein Blogpost'; SELECT * FROM blogposts; title | content | tags -----------------------+----------------+---------------------------- Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum} Mein Blogpost | Lorem ipsum... | {tag1,tag2,tag3,NULL,tag6} (2 rows)
  • 27. Partial array updatePartial array update UPDATE blogposts SET tags[4:5] = ARRAY['tag4', 'tag5'] WHERE title = 'Mein Blogpost'; title | content | tags -----------------------+----------------+---------------------------- Mein zweiter Blogpost | Lorem ipsum... | {lorem,ipsum} Mein Blogpost | Lorem ipsum... | {tag1,tag2,tag3,tag4,tag5} (2 rows)
  • 29. hstorehstore « [...] data type for storing sets of key/value pairs within a single PostgreSQL value. [...] Keys and values are simply text strings. » - PostgreSQL documentation
  • 30. Install hstore extensionInstall hstore extension CREATE EXTENSION hstore;
  • 31. Create hstore columnCreate hstore column CREATE TABLE products ( name text, price float, description text, metadata hstore );
  • 32. Insert hstore datasetInsert hstore dataset INSERT INTO products VALUES ( 'Product A', 123.3, 'Lorem ipsum', 'color => black, weight => 3kg'::hstore ); INSERT INTO products VALUES ( 'Product B', 45.0, 'Lorem ipsum', 'color => red'::hstore );
  • 33. Filtering hstore datasetFiltering hstore dataset SELECT metadata->'color' FROM products; ?column? ---------- black red (2 rows)
  • 34. Filtering hstore datasetFiltering hstore dataset SELECT metadata->'weight' FROM products; ?column? ---------- 3kg (2 rows)
  • 35. Search for a key in hstoreSearch for a key in hstore SELECT * FROM products WHERE metadata ? 'weight'; name | price | description | metadata -----------+-------+-------------+----------------------------------- Product A | 123.3 | Lorem ipsum | "color"=>"black", "weight"=>"3kg" (1 row)
  • 36. Search for key/value in hstoreSearch for key/value in hstore SELECT * FROM products WHERE metadata @> 'color => red'; name | price | description | metadata -----------+-------+-------------+---------------- Product B | 45 | Lorem ipsum | "color"=>"red" (1 row)
  • 37. Query for all hstore keysQuery for all hstore keys SELECT DISTINCT UNNEST(AKEYS(metadata)) as keys FROM products; keys -------- weight color (2 rows)
  • 38. Dealing with indexesDealing with indexes CREATE INDEX metadata_idx ON products USING GIN (metadata); EXPLAIN ANALYZE SELECT * FROM products WHERE metadata @> 'color => red'; QUERY PLAN --------------------------------------------------------------------- Bitmap Heap Scan on products (cost=12.00..16.01 rows=1 width=104) (actual time=0. Recheck Cond: (metadata @> '"color"=>"red"'::hstore) -> Bitmap Index Scan on metadata_idx (cost=0.00..12.00 rows=1 width=0) (actual Index Cond: (metadata @> '"color"=>"red"'::hstore) Total runtime: 0.100 ms (5 rows)
  • 39. Updating hstore datasetUpdating hstore dataset UPDATE products SET metadata = 'color => black, weight => 5kg'::hstore WHERE name =
  • 40. Partial hstore dataset updatePartial hstore dataset update UPDATE products SET metadata = metadata || 'weight => 1kg'::hstore WHERE name = 'Pr
  • 41. Removing item from hstoreRemoving item from hstore UPDATE products SET metadata = metadata - 'weight'::text;
  • 43. hstore Example: Auditinghstore Example: Auditing CREATE TABLE audit ( change_date timestamptz default now(), before hstore, after hstore ); create function audit() returns trigger language plpgsql as $$ begin INSERT INTO audit(before, after) SELECT hstore(old), hstore(new); return new; end; $$;
  • 44. hstore Example: Auditinghstore Example: Auditing create trigger audit after update on example for each row execute procedure audit(); select change_date, after - before as diff from audit; change_date | diff -------------------------------+----------- 2013-11-08 09:29:19.808217+02 | "f1"=>"b" 2013-11-08 09:29:19.808217+02 | "f2"=>"c" (2 rows) Source: Auditing Changes with Hstore
  • 45. JSONJSON « [...] the json data type has the advantage of checking that each stored value is a valid JSON value. » - PostgreSQL documentation
  • 46. Create JSON columnCreate JSON column CREATE TABLE products ( name text, price float, description text, metadata json );
  • 47. Insert JSON documentInsert JSON document INSERT INTO products VALUES ( 'Product A', 123.3, 'Lorem ipsum', ' { "color": "black", "weight": "3kg" } ' ); INSERT INTO products VALUES ( 'Product B', 45.0, 'Lorem ipsum', ' { "color": "red" } ' );
  • 48. Insert JSON documentInsert JSON document INSERT INTO products VALUES ( 'Product C', 9.95, 'Lorem ipsum', ' { "color": ["red", "green", "blue"] } ' );
  • 49. Insert JSON documentInsert JSON document INSERT INTO products VALUES ( 'Product D', 9.95, 'Lorem ipsum', ' { "color": ["red", "green", "blue", ] } ' ); ERROR: invalid input syntax for type json LINE 5: ' { "color": ["red", "green", "blue", ] } ' ^ DETAIL: Expected JSON value, but found "]". CONTEXT: JSON data, line 1: { "color": ["red", "green", "blue", ]...
  • 50. Filtering JSON documentFiltering JSON document SELECT metadata->>'color' FROM products; ?column? -------------------------- black red ["red", "green", "blue"] (3 rows)
  • 51. Filtering JSON documentFiltering JSON document SELECT metadata#>'{color, 2}' FROM products; ?column? ---------- "blue" (3 rows)
  • 52. Dealing with indexesDealing with indexes CREATE UNIQUE INDEX product_color ON products((metadata->>'color')); INSERT INTO products VALUES ( 'Product D', 21.95, 'Lorem ipsum', ' { "color": "red" } ' ); ERROR: duplicate key value violates unique constraint "product_color" DETAIL: Key ((metadata ->> 'color'::text))=(red) already exists.
  • 53. Updating JSON documentUpdating JSON document UPDATE products SET metadata = ' { "color": ["red", "green", "blue", "yellow"] } '
  • 55. Micro-JSON WebserviceMicro-JSON Webservice SELECT row_to_json(products) FROM products WHERE name = 'Product C'; row_to_json --------------------------------------------------------------------- {"name":"Product C","price":9.95,"description":"Lorem ipsum","metadata": { "color" (1 row)
  • 56. Micro-JSON WebserviceMicro-JSON Webservice SELECT row_to_json(t) FROM ( SELECT name, price FROM products WHERE name = 'Product C' ) t; row_to_json ----------------------------------- {"name":"Product C","price":9.95} (1 row)
  • 57. JSONbJSONb « There are two JSON data types: json and jsonb [...] The major practical difference is one of efficiency. » - PostgreSQL documentation
  • 58. Create JSONb columnCreate JSONb column CREATE TABLE products ( name text, price float, description text, metadata jsonb );
  • 59. Insert JSON documentInsert JSON document INSERT INTO products VALUES ( 'Product A', 123.3, 'Lorem ipsum', ' { "color": "black", "weight": "3kg" } ' ); INSERT INTO products VALUES ( 'Product B', 45.0, 'Lorem ipsum', ' { "color": "red" } ' );
  • 60. Insert JSON documentInsert JSON document INSERT INTO products VALUES ( 'Product D', 9.95, 'Lorem ipsum', ' { "color": ["red", "green", "blue", ] } ' ); ERROR: invalid input syntax for type json LINE 5: ' { "color": ["red", "green", "blue", ] } ' ^ DETAIL: Expected JSON value, but found "]". CONTEXT: JSON data, line 1: { "color": ["red", "green", "blue", ]...
  • 61. Dealing with indexesDealing with indexes CREATE INDEX metadata_idx ON products USING gin (metadata);
  • 62. Search for key/value in JSONSearch for key/value in JSON SELECT * FROM products WHERE metadata @> '{"color": "black"}'; name | price | description | metadata ------------+---------+-----------------+---------------------------- Product A | 123.3 | Lorem ipsum | {"color": "black", "weight": "3kg"} (1 row)
  • 63. Search for key/value in JSONSearch for key/value in JSON EXPLAIN ANALYZE SELECT * FROM products WHERE metadata @> '{"color": "black"}'; QUERY PLAN -------------------------------------------------------------------- Bitmap Heap Scan on products (cost=12.00..16.01 rows=1 width=104) (actual time=0. Recheck Cond: (metadata @> '{"color": "black"}'::jsonb) Heap Blocks: exact=1 -> Bitmap Index Scan on metadata_idx (cost=0.00..12.00 rows=1 width=0) (actual Index Cond: (metadata @> '{"color": "black"}'::jsonb) Planning time: 0.131 ms Execution time: 0.105 ms
  • 64. JSON key lookupJSON key lookup SELECT * FROM products WHERE metadata ? 'weight'; name | price | description | metadata ------------+---------+-----------------+---------------------------- Product A | 123.3 | Lorem ipsum | {"color": "black", "weight": "3kg"} (1 row)
  • 65. JSON key lookupJSON key lookup SELECT * FROM products WHERE metadata ?| array['weight', 'color']; name | price | description | metadata ------------+---------+-----------------+---------------------------- Product A | 123.3 | Lorem ipsum | {"color": "black", "weight": "3kg"} Product B | 45 | Lorem ipsum | {"color": "red"}
  • 66. JSON keys lookupJSON keys lookup SELECT * FROM products WHERE metadata ?& array['weight', 'color']; name | price | description | metadata ------------+---------+-----------------+---------------------------- Product A | 123.3 | Lorem ipsum | {"color": "black", "weight": "3kg"} (1 row)
  • 67. JSON vs. JSONbJSON vs. JSONb Use JSONb for complex operations JSONb needs more disk space than JSON Use JSON just for storage Use JSON when you need to keep the structure
  • 68. XMLXML « [...] it checks the input values for well-formedness, and there are support functions to perform type-safe operations on it. » - PostgreSQL documentation
  • 69. Create XML columnCreate XML column CREATE TABLE imports ( importDate date, content XML );
  • 70. Insert XML documentInsert XML document INSERT INTO imports VALUES ( '2014-04-05', '<?xml version="1.0"?> <order customer="4711"> <product id="1234">10</product> <product id="9876">50</product> </order>'::xml ); INSERT INTO imports VALUES ( '2014-04-05', '<?xml version="1.0"?> <order customer="5432"> <product id="1234">3</product> </order>'::xml );
  • 71. Insert XML documentInsert XML document INSERT INTO imports VALUES ( '2014-04-05', '<?xml version="1.0"?> <open></close>'::xml ); ERROR: invalid XML content LINE 3: '<?xml version="1.0"?> ^ DETAIL: line 2: Opening and ending tag mismatch: open line 2 and close <open></close> ^ line 2: chunk is not well balanced <open></close> ^
  • 72. Filtering XML documentFiltering XML document SELECT xpath('/order/product/@id', content) FROM imports; xpath ------------- {1234,9876} {1234} (2 rows)
  • 73. Filtering XML documentFiltering XML document SELECT UNNEST(xpath('/order/product/@id', content)::text[]) as productid, COUNT(*) as orders FROM imports GROUP BY productid; productid | orders -----------+-------- 9876 | 1 1234 | 2 (2 rows)
  • 74. Search in XML documentSearch in XML document SELECT * FROM imports WHERE xpath_exists('/order/product[@id=9876]', content); importdate | content ------------+--------------------------------- 2014-04-05 | <order customer="4711"> + | <product id="1234">10</product>+ | <product id="9876">50</product>+ | </order> (1 row)
  • 75. Create XML documentCreate XML document SELECT query_to_xml('SELECT * FROM products', true, false, '') as product; product -------------------------------------------------------------------- <table xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <row> + <name>Product A</name> + <price>123.3</price> + <description>Lorem ipsum</description> + <metadata> { "color": "black", "weight": "3kg" } </metadata> + </row> + + </table> + (1 row)
  • 77. Partition database tablesPartition database tables « [...] Partitioning refers to splitting what is logically one large table into smaller physical pieces. » - PostgreSQL documentation
  • 78. Partition database tablesPartition database tables CREATE TABLE sales_stats ( year int, product text, sales_by_quarter hstore ); CREATE TABLE sales_stats_2012( CHECK ( year = 2012 ) ) INHERITS (sales_stats); CREATE TABLE sales_stats_2011( CHECK ( year = 2011 ) ) INHERITS (sales_stats);
  • 79. Partition database tablesPartition database tables CREATE OR REPLACE FUNCTION sales_stats_part() RETURNS TRIGGER AS $BODY$ DECLARE _new_time int; _tablename text; _year text; _result record; BEGIN _new_time := ((NEW."time"/86400)::int)*86400; _year := to_char(to_timestamp(_new_time), 'YYYY'); _tablename := 'sales_stats_'||_year; PERFORM 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind = 'r' AND c.relname = _tablename;
  • 80. Partition database tablesPartition database tables IF NOT FOUND THEN EXECUTE 'CREATE TABLE ' || quote_ident(_tablename) || ' ( CHECK ( year = ' || quote_literal(_year) || ')) ) INHERITS (sales_stats)'; END IF; EXECUTE 'INSERT INTO ' || quote_ident(_tablename) || ' VALUES ($1.*)' USING NEW; RETURN NULL; END; $BODY$ LANGUAGE plpgsql; CREATE TRIGGER sales_stats_trigger BEFORE INSERT ON sales_stats FOR EACH ROW EXECUTE PROCEDURE sales_stats_part();
  • 81. To infinity and beyond!To infinity and beyond! Foreign Data Wrappers Range datatype Materialized views Conditional Indexes ...