Out of the box, PostGraphile supports rudimentary filtering on
connections using a
condition argument. This
allows you to filter for specific values (e.g.
username: "Alice" or
It's important when implementing filters to keep performance in mind, so
PostGraphile gives you the ability to omit certain fields from the list of
filters using the
@omit filter smart comment.
You may also use the
--no-ignore-indexes option to try and automatically omit
fields that don't appear to be indexed.
You can also augment PostGraphile's existing connections using custom Graphile Engine plugins, such as:
A very popular plugin is Matt Bretl's connection-filter plugin, located at
This adds a
filter argument to connections that enables you to use advanced
filters, including filtering on related records from other tables, using greater
than, less than and ranges for filtering, and even filtering against the output
of functions. If you need advanced filtering in your GraphQL API (and you can
use something like
to prevent malicious parties issuing complex requests) then I recommend you
check it out!
Some more of the community plugins relate to filtering, you can read more about them on the community plugins page