<slide>
<title>PostgreSQL: GIN Index</title>

<div effect="fade-out">
<image filename="gin_solution.png"/>
</div>

<div effect="fade-in">
<list>
	<bullet>Two types for JSONB fields (k/v or just v)</bullet>
	<bullet>Maps multiple values to a single document</bullet>
</list>

<break/>
<example>
INSERT INTO whisky VALUES( '{
	"name" : "Glen 25",
	"slug" : "glen-albyn-glen-25",
	"words" : [ "glen", "albyn", "25" ],
}' );
</example>

<break/>
<blurb>Key/Value match</blurb>
<example inline="2">
CREATE INDEX idxgin ON whisky USING *GIN (properties)*;
SELECT \* FROM whisky WHERE properties *@> '{"slug": "glen-albyn-glen-25"}'*;
</example>

<blurb>Array contains match</blurb>
<example inline="2">
CREATE INDEX idxgin ON whisky USING GIN (*( properties -> 'words' )*);
SELECT \* FROM whisky WHERE properties -> 'words' *?* 'albyn';
</example>
</div>
</slide>
