My doubt is quite general. I usually develope with SQL Server and My-SQL.
I want to know if there is ANY row that match the search. No matter in how many are there.
a) SELECT COUNT(colname1) FROM Foo WHERE colname2 = 'something' AND colname3 = 1;
b) SELECT colname1 FROM Foo WHERE colname2 = 'something' AND colname3 = 1 LIMIT 1;
Does first one need a full table scan? May be the second one faster, because it stops when the first match is found?