Solved

SQL Query

Posted on 2011-03-21
4
281 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
4 Comments
 
LVL 32

Assisted Solution

by:ewangoya
ewangoya earned 25 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 25 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now