query an indexed jsonb column
Since "37" is a string, not a number, your second query would have to use a jsonb string:

... WHERE p_attribute -&gt; 'age' @&gt; '"37"'::jsonb


Note the double quotes around 37.

Also note that this query wouldn't be able to use the index, while the first query can.