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 the alice row, which contains the exact value we specified in her education column: