Database Reference
In-Depth Information
Indexing and querying user-defined types
Like tuple columns, columns with user-defined types can be indexed and queried. Let's add
an index to our new education column:
CREATE INDEX ON "users" ("education");
Now we can query for a given value of education keeping in mind that, just as with a
tuple, we must specify the full value of the user-defined type, with all fields:
SELECT "username", "education" FROM "users"
WHERE "education" = {
"school_name": 'Big Data University',
"graduation_year": 2003
};
As expected, the result consists of alice 's row, which contains the exact value we speci-
fied in her education column:
Search WWH ::




Custom Search