From the course: Advanced SQL for Data Scientists
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Hstore for key-value pairs
From the course: Advanced SQL for Data Scientists
Hstore for key-value pairs
- [Instructor] Now, Postgres has features that may be more properly considered in the realm of NoSQL, including key-value stores and support for document structures using JSON. So let's first take a look at hstore. hstore is a data type for storing sets of key-value pairs. Now, we use hstore by first creating an extension. And an extension is a package or module that's part of Postgres but not installed by default. So we essentially install it by using the CREATE EXTENSION hstore command, and then we can create cables as we would normally. And for one of the comp source, several of the comps, we could specify the data type as hstore. Then when we insert data, we basically insert a string which is a list of key-value pairs. Now, why would you use hstore? Well, it's useful when it helps when keys are not predefined. So that is, the keys in the list can change arbitrarily. So if you have a large number of attributes and many…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Federated queries4m 13s
-
(Locked)
Bloom filters4m 38s
-
(Locked)
Hstore for key-value pairs6m 23s
-
(Locked)
JSON for semi-structured data8m 34s
-
(Locked)
Hierarchical data and ltrees11m 59s
-
(Locked)
Challenge: Design a table to support unstructured data33s
-
(Locked)
Solution: Design a table to support unstructured data58s
-
(Locked)
-