ORM allows applications to query and manipulate data in a database using an object-oriented paradigm. However, ORM can lead to performance issues due to "greedy fetching" where unnecessary joins are performed. It is better to write custom queries using aggregation functions to retrieve data from the database in one query and return it without mapping to objects to improve performance. ORM built-in functions should be avoided in favor of writing custom queries with joins and groups to control the queries issued to the database.