All messages should be posted in plain text.  HTML will be converted to
attachments.    The meditech-l web site is MTUsers.com
======================================

Title: Message

It appears to be fine from what I see. 

 

The only issue that could be raised is that you are converting your Date/Times in your WHERE clause to VARCHARS. 

In the table itself, the field is DATETIME.  If you look at the Execution Plan of your query, you’ll see that 99% of the cost of the query is scanning through the Cluster Index of the table.  Unless there is something built into the structure of your ASP that warrants a VARCHAR, try it without the conversion.  The GETDATE already returns a DATETIME anyway, so the data types will match.

 

If that still doesn’t help, and is possible with what you are doing, perhaps having your server pre-stage the data query into a smaller table (say hourly or nightly perhaps) using a scheduled DTS package.  This way, you will only be searching through a table with 7 days of data in it.

 

Let me know how you make out!

 

gmc

 

_______________________________________________________________

Garry McAninch

Dimensions Analysis

 Principal

Phone:  905-704-1356

Mobile:  905-941-1356

 

E-mail:  [EMAIL PROTECTED]

Web:     www.dimensionsanalysis.com

 


From: dr [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 17, 2006 8:01 PM
To: [EMAIL PROTECTED]
Subject: Any Faster Ideas?

 

 

It sure has been quiet lately.  I don't know if it's our new spam blocker but I thought I would put this out there and hope to see some responses.

 

Created a new web page showing the ER patient times from registration to discharge.  The difficult part was showing this for a snapshot of one week.  AdmitDateTime is a date/time field not just a date, so I had to use the convert command to get all visits for one day. I think the convert is what is slowing my query.  In the query analyzer it takes a a minute and 20 seconds to get a response back.  In ASP page, this times out and hardly ever shows the results.  Any ideas on how this can run faster, let me know.  Here's the query for one day:

 

SELECT DATENAME(Weekday,GETDATE()-7) As DAY,
CONVERT(VARCHAR,GETDATE()-7,110) As DATE,
AVG(DATEDIFF(hh,AdmitDateTime,DischargeDateTime)) As AvgTimeHrs,
Count(*) As PtsSeen from AbstractData where PtStatus = 'ER' And
CONVERT(VARCHAR,AdmitDateTime,110) = CONVERT(VARCHAR,GETDATE()-7,110);



---------------------------------------------------------------------------

Confidentiality Notice: This email is intended only for the person(s)

identified above. It contains information which may be privileged,

confidential and/or exempt from disclosure under law. If you are

not the intended recipient of the email, you are hereby notified that you should not review the contents of the email, and that any review,

dissemination, distribution or copying of this communication is strictly

prohibited. If you received this in error, please notify us immediately at

[EMAIL PROTECTED] Also, please either forward the email to

[EMAIL PROTECTED], or destroy it in such a way that it cannot be

accidentally redisclosed. Thank you.



Email [EMAIL PROTECTED] to subscribe to this list
Email [EMAIL PROTECTED] to unsubscribe from this list
Email [EMAIL PROTECTED] to send an email to all other subscribers (broadcast)
_______________________________________________
meditech-l mailing list
[email protected]
http://mtusers.com/mailman/listinfo/meditech-l

Reply via email to