Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL Query

Posted on 2011-03-21
4
Medium Priority
?
330 Views
Last Modified: 2012-05-11
I have a SQL Query that takes some time to return answer.  Is there a way to speed up the response?
The table has about 5,000,000 rows of data.

SELECT vol FROM tblVolDelta13_18 WHERE [deltaId] = '50' and [loadTime] = '25200' and [expiryId] = '2' and [loadDate] = '40623'

Generally, the idea is to retreive the vol data for the latest date.  Running this query does take about 30 seconds to retreive the answer.

Thanks,
0
Comment
Question by:blueteam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 32

Assisted Solution

by:Ephraim Wangoya
Ephraim Wangoya earned 100 total points
ID: 35184354

It may just be a case of indexes

Are all the fields in your where clause indexed
0
 
LVL 9

Accepted Solution

by:
Roman Gherman earned 100 total points
ID: 35184369
Hi,
You're doing checking for a string, why is that?
I think that those columns which you're filtering by are integers, aren't they?

I think the code should look like this:
SELECT vol FROM tblVolDelta13_18 WHERE [deltaId] = 50 and [loadTime] = 25200 and [expiryId] = 2 and [loadDate] = 40623

Open in new window


Plus try adding indexes where possible.
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 35185747
Check the database columns data type, probably you are using varchar instead of int, you should also update the query and remove the quotations to query about integers.
0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 35186953
Or you can use paging for this scenario.

Have a look here:

http://forums.devx.com/showthread.php?t=155210
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question