Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Trying to cut down query times

 
   Database Help (Home) -> Datamining RSS
Next:  MSSQLServer dependent service startup  
Author Message
Atley1

External


Since: Mar 25, 2004
Posts: 6



(Msg. 1) Posted: Wed Feb 16, 2005 2:51 pm
Post subject: Trying to cut down query times
Archived from groups: microsoft>public>sqlserver>datamining (more info?)

I have a query that is based on two other queries that are based on tables
in a database.

All of the queries that are used for this final query use grouping and
totals.

In the application I am making, I need to choose a date range to select the
subset of the data I need. This is done in the final query (it isn't known
until just before I run the query)

In the tests I have run, with the base queries selecting all the data for
all the dates, the whole thing takes more than 50 minutes to run. If I
interject the date range into the base query the whole thing takes les than
5. The only problem is that I cannot edit the base queries as this report
may be run at the same time by more than one user for more than one date
range.

I have looked in the bol and have been trying things with subqueries, but
from waht I can see, subqueries can only be used to parse data out of
another table, not merge data between two tables into one final recordset...

Help, someone has to have done this somewhere before, if you have a better
idea, or know how to do it with subqueries and know where i can find an
example, I would really appreciate it, I have been working on this for a
couple of days now.

Thanks

 >> Stay informed about: Trying to cut down query times 
Back to top
Login to vote
Adam Machanic1

External


Since: May 25, 2004
Posts: 67



(Msg. 2) Posted: Fri Feb 18, 2005 12:40 pm
Post subject: Re: Trying to cut down query times [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Can you post some actual code?


--
Adam Machanic
SQL Server MVP
<a style='text-decoration: underline;' href="http://www.sqljunkies.com/weblog/amachanic" target="_blank">http://www.sqljunkies.com/weblog/amachanic</a>
--


"Atley" <atley_1.RemoveThis@homtmail.com> wrote in message
news:uooENiFFFHA.3888@TK2MSFTNGP12.phx.gbl...
 > I have a query that is based on two other queries that are based on tables
 > in a database.
 >
 > All of the queries that are used for this final query use grouping and
 > totals.
 >
 > In the application I am making, I need to choose a date range to select
the
 > subset of the data I need. This is done in the final query (it isn't
known
 > until just before I run the query)
 >
 > In the tests I have run, with the base queries selecting all the data for
 > all the dates, the whole thing takes more than 50 minutes to run. If I
 > interject the date range into the base query the whole thing takes les
than
 > 5. The only problem is that I cannot edit the base queries as this report
 > may be run at the same time by more than one user for more than one date
 > range.
 >
 > I have looked in the bol and have been trying things with subqueries, but
 > from waht I can see, subqueries can only be used to parse data out of
 > another table, not merge data between two tables into one final
recordset...
 >
 > Help, someone has to have done this somewhere before, if you have a better
 > idea, or know how to do it with subqueries and know where i can find an
 > example, I would really appreciate it, I have been working on this for a
 > couple of days now.
 >
 > Thanks
 >
 ><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Trying to cut down query times 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Help w/query pls - Hi, I need to display on a monthly basis the policies sold showing the results in a row from their start date to the end date based on the following data: policy_cost, date_start and date_end Column one should display the first month (date_start)....

How to do updates upon the query results - Hello, I've run a complex SELECT statement combined of the several tables, which returns me: MemberID MemberName CurrentWeightAvailableOn010108 NeedsToHaveWeightOnDate Modifier(NeedsToHaveWeight-CurrentWeightAvailable) 1 John Doe ...

singleton query agains OLAP based model? - Hi, I have created a decision tree DM model from a cube. now I try the singleton query, but how to create the query???? the only samples I found works against an RDBMS model. so I'm not sure how to write my query: SELECT flattened [Test Dec..

Running a SQL query - table include FROM and TO columns - I am trying to export some calendar data from a sql table. This table has 2 column names "from" and "to" for the time range of the appointment. When I run the sql query: select date, from, to, act_code, mat_code, clt_code, notes, de...

Collation Problem any help - Hello all : My problem is like the following I have an online databse with a latin collation, this database is using ntext and nvarchar values that was with our previous admin ok the problem is in the data is stored should use another collation (the...
   Database Help (Home) -> Datamining All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]