Element query: find entries where a field's value is greater than, or less than another field's value?
I agree that any solution where you run a query and then conditionally render the result isn't very efficient.
You can do this in SQL by using the where() condition.
craft.entries
    .section('mySection')
    .where('content.field_field1 &gt; content.field_field2')
    .all()

Documentation on the where() condition can be found here.