Trying to find whether id2 is used in table X. Easiest way to use 'count':
SELECT COUNT(*) FROM X WHERE id1 = :1 AND id2 = :2 ;
If X is a large table containing over 90,00,000 data, above query has severe performance impact. Is there any alternative with better performance?
Note: both column have indexing in table X.