473,666 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how do we tune a large sql query

hi,
I have a problem asked by one of my senior person and finding the
answer .
What is the step by step procedure for tune a large sql query.
OR how do we tune a large SQL query with somany joins

Feb 6 '06 #1
6 4466
kv********@gmai l.com wrote:
hi,
I have a problem asked by one of my senior person and finding the
answer .
What is the step by step procedure for tune a large sql query.
OR how do we tune a large SQL query with somany joins


Assuming "tune" means "make faster". One methodology: look at the
execution plan and see where the DB spends the time. Then go from there.
See also http://www.sql-server-performance.com/

Kind regards

robert
Feb 6 '06 #2
>> What is the step by step procedure for tuning a large sql query. <<

What is the Good Life and how can I lead it, Socrates? Ghod, you work
for the iignorant.

Steps? There are only guidelines:
1) Have a normalized design, so the data has integrity.
2) The queries are a few magnitude of orders easily with 5NF
3) Trust thr optimizer, Luke

Feb 7 '06 #3
trust the optimizer, NOT.

wow. you START by trusting the optimizer. when stuff is slow, you dig
into it.

Feb 7 '06 #4
My point is a that slow code is usually the result of bad DDL, whcih in
turn leads to complex DML. You do not start by adding indexes and
hints. You fix the leak instead of mopping the floor, over and over.
But you remark is interesting, A friend of mine who writes database
engines for a major vendor observed that SQL Server people do not trust
their optimizer like Ingres, Postgres, DB2 people do. That is a bad
thing to say about the product.

The classic one was a test done by Fabian Pascal in DATABASE
PROGRAMMING & DESIGN years ago. It should still be in the CMP archives.
He wrote the same query seven different ways and ran them on various
SQL products on the same desktop hardware.

Ingres knew they were logically identical and produces the fastest
results of any
of the products. Oracle produced different execution plans for each
query and the slowest running one had to be shut down after grinding
for hours instead of seconds. The other products were all over the
place. But by now, everyone who is stil in business has improved since
those days.

Feb 7 '06 #5
The result is that many ms sql programmers do not trust the optimizer.

Your conclusion is that the optimizer in MS SQL can't be trusted.

Another possible conclusion is that there are no other engines widely
used.

I think the mssql engine can be trusted 99.9 percent of the time. But
if you step up into the big leagues, then you should have someone on
your team that knows what they are doing.

I know for a FACT that Oracle is the same way. Someone with good
business knowledge of the data can often speed large databases up.

Feb 26 '06 #6
>> A friend of mine who writes database
engines for a major vendor observed that SQL Server people do not trust

their optimizer like Ingres, Postgres, DB2 people do. That is a bad
thing to say about the product.
<<

that really depends on your perspective. For many practitioners RDBMS
as the whole package is much much more than just the optimizer. In many
situations the _whole solution_ implemented with SQL Server (including
DTS, reports, Web services etc.) is quite cheap to develop and to
maintain.

What's the point of developing the best optimizer in the world if all
the other links of the chain are weak?

Feb 26 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2753
by: Jason | last post by:
Does anyone know? Thanks so much.
10
2057
by: | last post by:
I am trying to improve the robustness and elegance of my parametized sql statements in ASP 3.0 as they get passed to the sql server SP. Could anyone tell me if there are weaknessess in the way I have written the following code? I have included both the asp code and the sql stored proceducre to tie things togoether....I appreciate any advice on this. It basically is a application to manage static news stories on our site by tracking and...
1
5088
by: gilgantic | last post by:
HELP!!! I am trying to fine tune or rewrite my SELECT statement which has a combination of SUM and CASE statements. The values are accurate, but the query is slow. BUSINESS RULE ============= 1. Add up Count1 when FIELD_1 has a value and FIELD_2 is NULL, or both have a value. 2. Add up Count2 when FIELD_2 has a value and FIELD_1 is NULL.
8
3258
by: Együd Csaba | last post by:
Hi All, how can I improve the query performance in the following situation: I have a big (4.5+ million rows) table. One query takes approx. 9 sec to finish resulting ~10000 rows. But if I run simultaneously 4 similar queries it takes nearly 5 minutes instead of 4 times 9 seconds or something near of that. here is a sample query: select mertido, fomeazon, ertektipus, mertertek from t_me30 where fomeazon in (select distinct fomeazon...
57
25505
by: Bing Wu | last post by:
Hi all, I am running a database containing large datasets: frames: 20 thousand rows, coordinates: 170 million row. The database has been implemented with: IBM DB2 v8.1
0
1593
by: Christoph Haas | last post by:
Hi, list... I have written an application in Perl some time ago (I was young and needed the money) that parses multiple large text files containing nested data structures and allows the user to run quick queries on the data. (For the firewall admins among you: it's a parser and web-based query tool for CheckPoint firewall rulebases. The user can search for source and destination IPs and get the matching rules.) The current application...
2
1332
by: blvandeb | last post by:
If anyone is able to provide advice for tuning the below query in sql server, it is much appreciated. In addition any index suggestions are also appreciated as I have access to the tables. Thank you. select a.id, isnull(b.advisement_satisfaction_yes, 0) as advisement_satisfaction_yes, isnull(c.advisement_satisfaction_no, 0) as advisement_satisfaction_no, case when isnull(b.advisement_satisfaction_yes, 0) >...
7
10818
by: =?Utf-8?B?TW9iaWxlTWFu?= | last post by:
Hello everyone: I am looking for everyone's thoughts on moving large amounts (actually, not very large, but large enough that I'm throwing exceptions using the default configurations). We're doing a proof-of-concept on WCF whereby we have a Windows form client and a Server. Our server is a middle-tier that interfaces with our SQL 05 database server.
8
2383
by: rshivaraman | last post by:
Hi : I have a TableA with around 10 columns with varchar and numeric datatypes It has 500 million records and its size is 999999999 KB. i believe it is kb i got this data after running sp_spaceused on it. The index_size was also pretty big in 6 digits. On looking at the tableA
0
8443
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7385
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.