Retrieving users by their age efficiently
You want to move the computation from the column, to the other side of the inequality operators where you have literals rather than a column:

WHERE birthday &gt;= current_date - interval '30 years' AND birthday &lt;= current_date - interval '21 years';


Then a simple index on "birthday" will make it efficient.  It might need some fiddling depending on what datatype "birthday" is.  I tested it as a timestamp without time zone.