473,738 Members | 10,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

query performance question

Hello. I have query performance question.
I need to optimize procedure

CREATE PROCEDURE dbo.SECUQUSRCOM PACCES
@P1 VARCHAR(50),
@P2 INTEGER
AS
DECLARE @IORGANIZATIONI D INTEGER
EXECUTE dbo.ORGNQGETORG ID @PORGUNIQUEID = @IORGANIZATIONI D OUTPUT

SELECT TSECCOMP.ID,
CASE TSECPROFILEGRP. ACCESSTYPE
WHEN -1 THEN
CASE TSECCLASS.DEFAU LTACCESS
WHEN -1 THEN
CASE TSECGROUPCOMP.D EFAULTACCESS
WHEN -1 THEN
TSECCOMP.DEFAUL TACCESS
ELSE
TSECGROUPCOMP.D EFAULTACCESS
END

ELSE
TSECCLASS.DEFAU LTACCESS
END
ELSE TSECPROFILEGRP. ACCESSTYPE
END AS EXPR1
FROM TSECCOMP
INNER JOIN ((TSECPROFILE
INNER JOIN (TSECCLASS
INNER JOIN TSECPROFILEGRP
ON TSECCLASS.UNIQU EID = TSECPROFILEGRP. SECURITYGROUPID )
ON TSECPROFILE.UNI QUEID = TSECPROFILEGRP. PROFILEID) INNER JOIN
TSECGROUPCOMP ON TSECCLASS.UNIQU EID = TSECGROUPCOMP.S ECURITYGROUPID)
ON TSECCOMP.UNIQUE ID = TSECGROUPCOMP.S ECCOMPID
WHERE
(
CASE TSECPROFILEGRP. ACCESSTYPE
WHEN -1 THEN
CASE TSECCLASS.DEFAU LTACCESS
WHEN -1 THEN
CASE TSECGROUPCOMP.D EFAULTACCESS
WHEN -1 THEN
TSECCOMP.DEFAUL TACCESS
ELSE
TSECGROUPCOMP.D EFAULTACCESS
END
ELSE
TSECCLASS.DEFAU LTACCESS
END
ELSE TSECPROFILEGRP. ACCESSTYPE
END > 0 ) AND (TSECPROFILE.KE YVALUE=@P1) AND ( TSECCOMP.TYPE =@P2)
AND TSECCOMP.ORGANI ZATIONID = @IORGANIZATIONI D
GO
Thank you In advance.
Jul 20 '05 #1
2 1749
Make sure you have indexed the join keys. You can try running the Index
Tuning Wizard for advice.

Gert-Jan
inna wrote:

Hello. I have query performance question.
I need to optimize procedure

CREATE PROCEDURE dbo.SECUQUSRCOM PACCES
@P1 VARCHAR(50),
@P2 INTEGER
AS
DECLARE @IORGANIZATIONI D INTEGER
EXECUTE dbo.ORGNQGETORG ID @PORGUNIQUEID = @IORGANIZATIONI D OUTPUT

SELECT TSECCOMP.ID,
CASE TSECPROFILEGRP. ACCESSTYPE
WHEN -1 THEN
CASE TSECCLASS.DEFAU LTACCESS
WHEN -1 THEN
CASE TSECGROUPCOMP.D EFAULTACCESS
WHEN -1 THEN
TSECCOMP.DEFAUL TACCESS
ELSE
TSECGROUPCOMP.D EFAULTACCESS
END

ELSE
TSECCLASS.DEFAU LTACCESS
END
ELSE TSECPROFILEGRP. ACCESSTYPE
END AS EXPR1
FROM TSECCOMP
INNER JOIN ((TSECPROFILE
INNER JOIN (TSECCLASS
INNER JOIN TSECPROFILEGRP
ON TSECCLASS.UNIQU EID = TSECPROFILEGRP. SECURITYGROUPID )
ON TSECPROFILE.UNI QUEID = TSECPROFILEGRP. PROFILEID) INNER JOIN
TSECGROUPCOMP ON TSECCLASS.UNIQU EID = TSECGROUPCOMP.S ECURITYGROUPID)
ON TSECCOMP.UNIQUE ID = TSECGROUPCOMP.S ECCOMPID
WHERE
(
CASE TSECPROFILEGRP. ACCESSTYPE
WHEN -1 THEN
CASE TSECCLASS.DEFAU LTACCESS
WHEN -1 THEN
CASE TSECGROUPCOMP.D EFAULTACCESS
WHEN -1 THEN
TSECCOMP.DEFAUL TACCESS
ELSE
TSECGROUPCOMP.D EFAULTACCESS
END
ELSE
TSECCLASS.DEFAU LTACCESS
END
ELSE TSECPROFILEGRP. ACCESSTYPE
END > 0 ) AND (TSECPROFILE.KE YVALUE=@P1) AND ( TSECCOMP.TYPE =@P2)
AND TSECCOMP.ORGANI ZATIONID = @IORGANIZATIONI D
GO
Thank you In advance.

Jul 20 '05 #2
Hi

Check out the query execution plan

http://www.sql-server-performance.co...n_analysis.asp

http://www.sql-server-performance.com/transact_sql.asp

John
"inna" <me****@hotmail .com> wrote in message
news:34******** *************** ***@posting.goo gle.com...
Hello. I have query performance question.
I need to optimize procedure

CREATE PROCEDURE dbo.SECUQUSRCOM PACCES
@P1 VARCHAR(50),
@P2 INTEGER
AS
DECLARE @IORGANIZATIONI D INTEGER
EXECUTE dbo.ORGNQGETORG ID @PORGUNIQUEID = @IORGANIZATIONI D OUTPUT

SELECT TSECCOMP.ID,
CASE TSECPROFILEGRP. ACCESSTYPE
WHEN -1 THEN
CASE TSECCLASS.DEFAU LTACCESS
WHEN -1 THEN
CASE TSECGROUPCOMP.D EFAULTACCESS
WHEN -1 THEN
TSECCOMP.DEFAUL TACCESS
ELSE
TSECGROUPCOMP.D EFAULTACCESS
END

ELSE
TSECCLASS.DEFAU LTACCESS
END
ELSE TSECPROFILEGRP. ACCESSTYPE
END AS EXPR1
FROM TSECCOMP
INNER JOIN ((TSECPROFILE
INNER JOIN (TSECCLASS
INNER JOIN TSECPROFILEGRP
ON TSECCLASS.UNIQU EID = TSECPROFILEGRP. SECURITYGROUPID )
ON TSECPROFILE.UNI QUEID = TSECPROFILEGRP. PROFILEID) INNER JOIN
TSECGROUPCOMP ON TSECCLASS.UNIQU EID = TSECGROUPCOMP.S ECURITYGROUPID)
ON TSECCOMP.UNIQUE ID = TSECGROUPCOMP.S ECCOMPID
WHERE
(
CASE TSECPROFILEGRP. ACCESSTYPE
WHEN -1 THEN
CASE TSECCLASS.DEFAU LTACCESS
WHEN -1 THEN
CASE TSECGROUPCOMP.D EFAULTACCESS
WHEN -1 THEN
TSECCOMP.DEFAUL TACCESS
ELSE
TSECGROUPCOMP.D EFAULTACCESS
END
ELSE
TSECCLASS.DEFAU LTACCESS
END
ELSE TSECPROFILEGRP. ACCESSTYPE
END > 0 ) AND (TSECPROFILE.KE YVALUE=@P1) AND ( TSECCOMP.TYPE =@P2)
AND TSECCOMP.ORGANI ZATIONID = @IORGANIZATIONI D
GO
Thank you In advance.

Jul 20 '05 #3

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

Similar topics

1
4290
by: Paul | last post by:
Assume you have two varchar (or Text) columns named L and U which are identical except that the charset for L is latin1 and the charset for U is utf8. All the records in L and U are identical in terms of content, consisting of only 7 bit ASCII characters. Both columns have indexes of the same type (e.g. assume Unique indexes if you want). Here's my question: Will the fact that column U has a utf8 charset make select queries run slower on...
8
3270
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...
0
3300
by: phlype.johnson | last post by:
I'm struggling to find the best query from performance point of view and readability for a normalized DB design. To illustrate better my question on whether normalized designs lead to more complex queries yes or no, I have prepared an example. The example is a database with the following tables: *table person with fields: -persid: autoincrement id -name: name of the person *table material with fields: -materialid: autoincrement id
1
4220
by: Jimbo | last post by:
I have a query..if you look at the bottom of the where clause you'll see an "NOT IN" statement that is really hanging up the query..i'm trying to replace with a "NOT EXISTS" but it isnt appearing to work...I need to get a result set where the email address of the outter most query is not in that sub query...thanks: -->Code Begins Here SELECT DISTINCT
0
8788
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
9335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8210
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...
0
6053
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
4570
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...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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.