Hi,
This may still not be appropriate for CI4, I am not sure as I have not used it yet.
However, I think this is too specific to be included in a framework.
But based on you first post you are concern about performance on large datasets.
As far are I know SQL, EXISTS is use with sub-queries and in most cases (if not all) a sub-query will require the server to create a temporary table in memory or on disk ( depends on server environment ).
If you use a Limit clause, the result is return after the limit is reach.
So in theory a limit clause would perform better
Index columns that are use for search will increase search performance, but will affect insert/update operations.
So you need to evaluate what is more taxing on the server.
It may also be a good idea to look into different SQL server.
Just my 2 cents.
A good decision is based on knowledge and not on numbers. - Plato