>« So, the first one is a pass-thru query that returns a large dataset
> which then gets munched on by all the subsequent queries. Might that
> large
> data transfer cause some of the slowdown that we're seeing? Could it be
> faster to do all the processing within a sproc and only return the final
> dataset? »
>
> Yes, of course. However, it's impossible to tell you by how much you will
> see an increase in performance for running all this directly on the
> SQL-Server; you will have to make the test yourself.
>
> --
> Sylvain Lafontaine, ing.
> MVP - Technologies Virtual-PC
> E-mail:
http://cerbermail.com/?QugbLEWINF>
>
> "Bagger" <Bagger[ at ]discussions.microsoft.com> wrote in message
> news:5BA98355-E324-4EC3-A0C2-F64E98F67F48[ at ]microsoft.com...
>> Ok, I understand what you're saying, and I agree that it won't make much
>> difference if we just slap the queries into a sproc. The queries are
>> crunching through a lot of data, and do things like using case statements
>> within the sql to modify the values as it goes.
>>
>> Now, we're definitely not running these queries multiple times, but we
>> are
>> running multiple queries with each one based on the output of the
>> previous
>> one. So, the first one is a pass-thru query that returns a large dataset
>> which then gets munched on by all the subsequent queries. Might that
>> large
>> data transfer cause some of the slowdown that we're seeing? Could it be
>> faster to do all the processing within a sproc and only return the final
>> dataset?
>>
>> I haven't worked with SQL Server in quite a while and I think I've
>> probably
>> forgotten a lot of what I learned about optimization, so I'll definitely
>> need
>> to brush up on that before attempting to create an optimized sproc to
>> handle
>> one of their reports. Guess there's no real way around that though :(
>>
>> "Sylvain Lafontaine" wrote:
>>
>>> Once compiled, there is no real difference between them if the
>>> underlying
>>> code is the same. You will have a difference if you are sending the
>>> same
>>> query a few hundred or a thousand times per second but for a job which
>>> is
>>> taking 10 minutes, I don't see what difference this could make.
>>>
>>> However, the best way to be sure would be to make the test; so why don't
>>> you
>>> grab one of these build sql string, put it in a stored procedure and see
>>> what time this SP take to run?
>>>
>>> This doesn't mean that you cannot optimize your queries (if it is
>>> possible
>>> to do so, of course). However, you don't provide any information on
>>> this
>>> regard. For example, does the fact that some of these tables have some
>>> hundred millions of rows means that all these rows must be read for
>>> generating a report or if only a few rows are required?
>>>
>>> You can always hire someone but in my opinion, the first thing to do
>>> would
>>> be to buy some good books on optimizing SQL-Server and queries and the
>>> second thing to do would be to take a serious look at the generated
>>> query's
>>> plans.
>>>
>>> --
>>> Sylvain Lafontaine, ing.
>>> MVP - Technologies Virtual-PC
>>> E-mail:
http://cerbermail.com/?QugbLEWINF>>>
>>>
>>> "Bagger" <Bagger[ at ]discussions.microsoft.com> wrote in message
>>> news:7C1EF3D5-DEE2-4A1B-93FB-FD0D184DA9D6[ at ]microsoft.com...
>>> > I'm working with someone trying to revamp their reporting system.
>>> > They
>>> > are
>>> > currently using SQL Server 2000 as the backend and Access for doing
>>> > their
>>> > reporting. The problem is that they are building these huge
>>> > complicated
>>> > pass-thru queries, and often stringing several queries together to get
>>> > the
>>> > dataset they need for their report. The analysts know Access pretty
>>> > well
>>> > and
>>> > are comfortable with it, but the performance is just pretty bad. A
>>> > few of
>>> > the reports take more than 10 minutes to run.
>>> >
>>> > Now they aren't dealing with a small database. A couple of the tables
>>> > have
>>> > nearly a hundred million records in them. Now, I can't ask for anyone
>>> > to
>>> > tell me whether a specific set of queries, re-written as a stored
>>> > procedure
>>> > would be a major improvement or not, since I would have to give you a
>>> > boatload of info on the tables, their relationships, and all the index
>>> > info,
>>> > among other things before you could really give a good answer.
>>> >
>>> > Since that's not very practical, what I'd like to find is more general
>>> > information about pass-thru queries vs. stored procedures. What
>>> > benefits
>>> > can
>>> > be gained from using one vs. the other. What is the recommended
>>> > method of
>>> > using Access as a reporting tool for SQL Server? What I'm trying to
>>> > do
>>> > here
>>> > is to see if there is justification for continuing to use Access or
>>> > not,
>>> > and
>>> > whether they continue to use it, or something else, whether stored
>>> > procedures
>>> > will be necessary to achieve the performance they want. If it looks
>>> > like
>>> > stored procedures are necessary, I'll need to make the case for them
>>> > to
>>> > hire
>>> > someone to create those procedures. So this is about finding the info
>>> > necessary to build a case for that, or for something else if the
>>> > findings
>>> > lead elsewhere.
>>>
>>>
>>>
>
>