I have in my form the option to perform a search for Rg or Cpf. Then I came to doubt about query performance using the following code:
SELECT * FROM DADOSPESSOAIS WHERE (Rg = @Rg OR Cpf = @Cpf);
This code above "costs" more than if I made two queries, ie I made a query for Rg and if I returned null I would make another one for Cpf?
SELECT * FROM DADOSPESSOAIS WHERE (Rg = @Rg);
SELECT * FROM DADOSPESSOAIS WHERE (Cpf = @Cpf);