Efficient Filtering
Filter early and use indexed fields for better performance.
Best Practiceβ
query GetFilteredAtoms($type: atom_type!, $since: timestamptz!) {
atoms(
where: {
type: { _eq: $type }
created_at: { _gte: $since }
}
limit: 100
) {
term_id
label
}
}
Indexed Fieldsβ
These fields have database indexes:
term_id(primary key)creator_idtypecreated_at
Operator Selectionβ
- Use
_eqfor exact matches (not_ilike) - Use
_ilikeonly for pattern matching - Use
_infor multiple values - Combine filters with
_andfor specificity