If you expect count(*) to be approximately 1 then I wouldn't think there would be any difference at all.
But the answer to all questions of the form "I have a complex system that I don't understand and I want to know if A is faster than B" is always "Try it and see what happens".
Really? Wouldn't it be easier to just write some small programs specifically for testing the options? I don't see them requiring more than about 25 lines of code with all exception-handling included.
Originally posted by jaikiran pai:
To do that we need to change quite a bit of code, so just wanted to make sure that we are atleast trying out a right approach
Originally posted by jay ceebee:
if this is the case, wouldn't it be simple to just add a unique constraint on both firstname and lastname combi, then simply let your program handle the exception thrown when inserting a duplicate entry.
Currently we are looking at improving the performance of the application.
count(*) is almost always faster than select * as there is less network traffic involved. For one row the difference wouldn't be significant unless you have LOB fields in the table.
Before optimizing this SQL query, do you know that it is the bottleneck. I would think it is more likely that something else is. It's a pretty simple query that tweaking the result type is unlikely to help.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton