Re: Two queries versus one combined query
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Tue, 5 Jun 2007 17:13:12 -0400
Adrienne Boswell wrote:
I have a classic asp page that lists products. Right now, there is
one query to get the list of products (from a product view), and then
another query to get the individual merchant's information (from a
vendor view). I am thinking that using one query for both is going to
save some server time because it's only one trip to the db. In my
testing, however, it seems that the time to do both is .00 and to do a
combined query is .01.
Where are you getting these timing numbers? From Query Analyzer? Are
these values in seconds?
Is there a rounding or truncation issue? Could .00 have started life as
..0099?
I am using MS SQL.
What version?
<snip>
Any thoughts? I am correct that the combined query is better in the
long run?
Frankly it would never even have occurred to me not to do a join and
bring the data back all at once. Depending on your answers to the
previous questions, I would investigate why the join is so much slower
than the non-join. Are the tables properly indexed? Have you used the
Index Analyzer (Tuning Wizard) to verify?
I don't think I can make a sp out of this because the userActually you can, although performance may suffer depending on the
can choose sorting, and can also include a keyword search.
technique you use. See Erland's articles on dynamic search criteria and
dynamic sorting at http://www.sommarskog.se/index.html
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
.
- Follow-Ups:
- Re: Two queries versus one combined query
- From: Adrienne Boswell
- Re: Two queries versus one combined query
- References:
- Two queries versus one combined query
- From: Adrienne Boswell
- Two queries versus one combined query
- Prev by Date: Two queries versus one combined query
- Next by Date: Re: Two queries versus one combined query
- Previous by thread: Two queries versus one combined query
- Next by thread: Re: Two queries versus one combined query
- Index(es):
Relevant Pages
|