I have a table with maybe 3-5 billions rows. I need to check if a specific value is in that table, which is the fastest way?
SELECT COUNT(*) AS total FROM schema.table WHERE row = 'pattern'; -- Must return 1 or 0
vs
SELECT true AS is_in_table FROM schema.table WHERE row = 'pattern' -- Must return true or no one row at all
Which is the best way to get the 'fastest' result using the appropriate column indexing?