Element query: find entries where a field's value is greater than, or less than another field's value? I would like to do something like this:

craft.entries.section('mySection').field1('&gt; field2').all()


And it should return all the entries in mySection whose field1 value is greater than their field2 value.

Is it possible?
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.