Re: Two queries versus one combined query

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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 user
can choose sorting, and can also include a keyword search.

Actually you can, although performance may suffer depending on the
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.


.



Relevant Pages

  • RE: LDAP query for xerox 3545 printer/scanner blocked by SBS 2003?
    ... I am able to query the LDAP successfully from the second workstation but not ... Microsoft CSS Online Newsgroup Support ... This newsgroup only focuses on SBS technical issues. ... Step2:Please ensure the DNS on workstation is pointed to SBS server. ...
    (microsoft.public.windows.server.sbs)
  • Re: need help designin a report
    ... There will be a query on the child table that does the same. ... Design the form that will become your subform to properly display the things ... subform to the proper place on your main form. ... >> I suggested in the earlier thread in this newsgroup (the subject was ...
    (microsoft.public.access.gettingstarted)
  • Re: Cant update table data from form
    ... > tables (the form is built on tables, not queries). ... to more than one newsgroup, ... If the record source of the form is a table (not a multi-table query) ...
    (microsoft.public.access.forms)
  • Re: ODBC with AS400
    ... Ryan wrote: ... update query it is going to return every record in the Update To ... Please reply to the newsgroup. ... get a quicker response by posting to the newsgroup. ...
    (microsoft.public.access.queries)
  • Re: Database query performance
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ... Indexing of DateTime column does not ... >> To see how the server is handling the query, you can turn on the query ... >> Please reply only to the newsgroup so that others can benefit. ...
    (microsoft.public.dotnet.framework.adonet)