Showing posts with label performance. Show all posts
Showing posts with label performance. Show all posts

Friday, March 30, 2012

OPENQUERY vs EXECUTE on a linked server -- what is better?

Can anyone tell me, if, generally, the performance or the cost of executing a pass-through command on a linked server in SQL Server 2005 would be better using OPENQUERY or the new option with EXECUTE -- whether the two servers are on the same box or not? I haven't been able to find a comparison between the two.

Have there been any tests of the difference?

What effect on performance is there with 'rpc out' set with sp_serveroption so EXECUTE can be used?

To be more specific I have a development box with SQL Server 2005 and Oracle 9.2.

The new option with EXECUTE would be something like the example in MSDN (Example J.) at:

http://msdn2.microsoft.com/en-us/library/ms188332.aspx


EXEC ( 'SELECT * FROM scott.emp') AT ORACLE;
GO

Well, openquery/rowset/datasource only takes literal string (i.e. you cannot user string variable). The new Execute syntax allows you do the same pass-through as with openquery but also allows the use of variable. If you're doing lots of cross server invocation, this is certainly a major benefit.

As for perf implication, there wouldn't be much of a difference between both methods. I would bet the Exec would actually be better.

sql

Wednesday, March 21, 2012

Open source tools for performance analysis

Hi all,
Does anyone know of an open source tool capable of analyzing SQL server
performance (something comparable to Spotlight maybe or even something like
OpenSQLTrace with a good interface) ?
Thanks,
kokonut,
I don't know of any Open Source products to do this. SQL Profiler in
combination with Windows Performance monitor is pretty good for this
kind of work.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
kokonut wrote:
> Hi all,
> Does anyone know of an open source tool capable of analyzing SQL server
> performance (something comparable to Spotlight maybe or even something like
> OpenSQLTrace with a good interface) ?
> Thanks,
>
|||There is a freeware mode for Quest's Spotlight on SQL Server that's enabled without a key. In the interest of fairness, I think Idera has something similar.
There's also the SQL2H tool that does some tracking of SQL Server perfmon counters. It's one of the top downloads on http://www.microsoft.com/sql.
Hope this helps,
-kev
~~~
-Kevin Kline
Quest Software (www.quest.com)
SQL Server MVP
I support PASS, the Professional Association for SQL Server. (www.sqlpass.org)

> Hi all,
> Does anyone know of an open source tool capable of analyzing SQL
> server performance (something comparable to Spotlight maybe or even
> something like OpenSQLTrace with a good interface) ?
> Thanks,
>

Open source tools for performance analysis

Hi all,
Does anyone know of an Open Source tool capable of analyzing SQL server
performance (something comparable to Spotlight maybe or even something like
OpenSQLTrace with a good interface) ?
Thanks,kokonut,
I don't know of any Open Source products to do this. SQL Profiler in
combination with Windows Performance monitor is pretty good for this
kind of work.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
kokonut wrote:
> Hi all,
> Does anyone know of an Open Source tool capable of analyzing SQL server
> performance (something comparable to Spotlight maybe or even something lik
e
> OpenSQLTrace with a good interface) ?
> Thanks,
>|||There is a freeware mode for Quest's Spotlight on SQL Server that's enabled
without a key. In the interest of fairness, I think Idera has something sim
ilar.
There's also the SQL2H tool that does some tracking of SQL Server perfmon counters. It
's one of the top downloads on http://www.microsoft.com/sql.
Hope this helps,
-kev
~~~
-Kevin Kline
Quest Software (www.quest.com)
SQL Server MVP
I support PASS, the Professional Association for SQL Server. ([url]www.sqlpass.org[/url
])

> Hi all,
> Does anyone know of an Open Source tool capable of analyzing SQL
> server performance (something comparable to Spotlight maybe or even
> something like OpenSQLTrace with a good interface) ?
> Thanks,
>sql

Open source tools for performance analysis

Hi all,
Does anyone know of an open source tool capable of analyzing SQL server
performance (something comparable to Spotlight maybe or even something like
OpenSQLTrace with a good interface) ?
Thanks,kokonut,
I don't know of any Open Source products to do this. SQL Profiler in
combination with Windows Performance monitor is pretty good for this
kind of work.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
kokonut wrote:
> Hi all,
> Does anyone know of an open source tool capable of analyzing SQL server
> performance (something comparable to Spotlight maybe or even something like
> OpenSQLTrace with a good interface) ?
> Thanks,
>|||There is a freeware mode for Quest's Spotlight on SQL Server that's enabled without a key. In the interest of fairness, I think Idera has something similar.
There's also the SQL2H tool that does some tracking of SQL Server perfmon counters. It's one of the top downloads on http://www.microsoft.com/sql.
Hope this helps,
-kev
~~~
-Kevin Kline
Quest Software (www.quest.com)
SQL Server MVP
I support PASS, the Professional Association for SQL Server. (www.sqlpass.org)
> Hi all,
> Does anyone know of an open source tool capable of analyzing SQL
> server performance (something comparable to Spotlight maybe or even
> something like OpenSQLTrace with a good interface) ?
> Thanks,
>

Monday, March 12, 2012

Open Connection

Hi to all,
I know that we should close sql connection when it's complete its job for
performance and sql server's resources. But i can't find article or text
for
this subject on the internet. Or i know not true?
Could you share with me if you have like this article ?For internet applications you should use connection pooling, and close your
connection as soon as you are finished. The provider (or driver) will
automatically keep the connection open for you and re-use it if you open
another connection using the same connection string within the connection
pool timeout period. Just search for "SQL Server connection pooling" and
I'm sure you will find more information
"Erencan SAÐIROÐLU" <erencans@.hotmail.com> wrote in message
news:uaeY1jc%23GHA.5092@.TK2MSFTNGP04.phx.gbl...
> Hi to all,
> I know that we should close sql connection when it's complete its job for
> performance and sql server's resources. But i can't find article or text
> for
> this subject on the internet. Or i know not true?
> Could you share with me if you have like this article ?
>|||Thank you Brain
"Brian Pursley" <bp@.cinlogic.com> wrote in message
news:eS5EPNj%23GHA.4800@.TK2MSFTNGP05.phx.gbl...
> For internet applications you should use connection pooling, and close
> your connection as soon as you are finished. The provider (or driver)
> will automatically keep the connection open for you and re-use it if you
> open another connection using the same connection string within the
> connection pool timeout period. Just search for "SQL Server connection
> pooling" and I'm sure you will find more information
> "Erencan SAÐIROÐLU" <erencans@.hotmail.com> wrote in message
> news:uaeY1jc%23GHA.5092@.TK2MSFTNGP04.phx.gbl...
>> Hi to all,
>> I know that we should close sql connection when it's complete its job for
>> performance and sql server's resources. But i can't find article or text
>> for
>> this subject on the internet. Or i know not true?
>> Could you share with me if you have like this article ?
>

Friday, March 9, 2012

OOP Objects and SSRS ? Doable? Reusable? Performance?

Is there any way to reuse Objects that returns a collection to my
report in SSRS?
Is it practical? Will it perform okay if I need to join the output
from that object with other data? Say I have a vb.net object that
already has all the business logic that joins a bunch of objects
(tables really). It's in one place and we like it that way. If I want
to use SSRS will I have to code a select (or a create a view) to get
my same expected row set?
Thanks for any help or information.You have several options. None of them great as far as I am concerned.
One is to use the reportviewer control that ships with VS 2005 and VS 2008.
Use it in local mode. In local mode you give it a dataset and a report.
However, there is a lot more coding and complexity involved and you lose the
server capabilities (subscriptions, performance, etc).
Two, to write a data processing extension. Non-trivial but possible. I would
read up on that in books online.
Or, have a web service that you query and get the data back from it. That
will work as well.
RS is not architected to perform this type of integration easily. It is a
SOA (service oriented architecture).
Crystal reports might work better if this is a hard and fast requirement.
But, do look up data processing extension. That is the best bet for you.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<wildman@.noclient.net> wrote in message
news:0802c9d7-98bb-4875-8f15-c24782d51cdd@.x35g2000hsb.googlegroups.com...
> Is there any way to reuse Objects that returns a collection to my
> report in SSRS?
> Is it practical? Will it perform okay if I need to join the output
> from that object with other data? Say I have a vb.net object that
> already has all the business logic that joins a bunch of objects
> (tables really). It's in one place and we like it that way. If I want
> to use SSRS will I have to code a select (or a create a view) to get
> my same expected row set?
> Thanks for any help or information.|||If the collections returned by your objects are 'flat' (have no nested
objects), you should be able to report on them, by exposing them as a web
service. See http://technet.microsoft.com/en-us/library/aa964129.aspx.
The documentation is a little sketchy. It works if your objects returns just
a list of fields. If there are nested objects, its not so simple.
<wildman@.noclient.net> wrote in message
news:0802c9d7-98bb-4875-8f15-c24782d51cdd@.x35g2000hsb.googlegroups.com...
> Is there any way to reuse Objects that returns a collection to my
> report in SSRS?
> Is it practical? Will it perform okay if I need to join the output
> from that object with other data? Say I have a vb.net object that
> already has all the business logic that joins a bunch of objects
> (tables really). It's in one place and we like it that way. If I want
> to use SSRS will I have to code a select (or a create a view) to get
> my same expected row set?
> Thanks for any help or information.

OO Database Design performance question

I am hoping someone has had a similar table design scenario and has a slick solution that i am not thinking of.

Basically I have the following tables (kind of OO based design in this case).

Create Table Entity (EntityID int, EntityTypeID)

Create Table Company (EntityID, CompanyName)

Create Table Contact (EntityID, FirstName, LastName)

Create Table Group (EntityID, GroupName)

Basically an Entity can be a Company, a Contact or a Group based on the EntityTypeID

The trick becomes when I get an EntityID is how to get the name of the Entity in an efficient manner.

You can make a view that does a Union to all three tables like such...

select CompanyName as Name from Company

union all

Select FirstName + LastName as Name from Contact

union all

Select GroupName as Name from Group

Perfomance wise this stinks. I have also tried a left join to all the tables and that performs better, but still not great when you are joining a bunch of records (such as Orders back to get the name of the Entity on the order).

I was thinking of an indexed view but it doesn't let you do a left join or a union. A trigger also comes to mind but I have other triggers on those tables and I really don't want to create any more. I could also add all the different name columns to the entity table but then I end up with a bunch of null values.

Any creative ideas on how to create a function, view, indexed view, etc that will make this efficient?

Thanks!

OO designs often fail to translate well to a high-performance transactional database. Subtypes are especially troublesome in this regard.

The problem here is one of abstraction. The more you abstract something, the more it becomes difficult to query in a practical way. Some package software takes this to the extreme with the concept of the "thing" table. works great on the whiteboard but kills performance as tables get large.

A function is probably going to be your best option. Write a T-SQL function that chooses the table for the lookup based on the type column. You can either pass in the type as a parameter or look it up in the function.

something like:

if @.type = 1 then
select @.retval = companyname from Company

if @.type = 2
select @.retval = firstname+lastname from Contact

if @.type = 3
select @.retval = groupname from group

|||

The key here is that if you are going to use subtypes, (and I am a big fan) you must keep everything that is common between them in the same table, otherwise you are just asking for trouble. The problem here is that you have to be careful with subtypes not to overdo them, and in ths case I think you may have done that. In SQL, if you are going to do a subtype, the supertype really needs be compellingly similar and have a similar purpose.

For example, a vehicle type might be proper for an auto shop, because all vehicles are tracked the same, then each subtype has some differences. Or you might have a patient supertype (records, names bills, etc) and then subtypes for male patients and female ones.

In your case, the subtypes have nothing to do with one another so there is no point and all you are doing is forcing this OO design into a database. You could fix your performance problems by adding a Name column to the Entity table and update it using a trigger on each of the supertypes, but unless there really is some compelling similarities that merit a supertype, you should rethink your design.

|||Take a look at the AdventureWorks sample database. IMHO, it has a very good normalized representaion of Contacts/People/Customers, etc.|||I agree that a function will work however when it comes to searching based on name the function is going to scan which obviously wouldn't be good.|||

i see your point however I argue that it does need an OO design. For example a Customer that orders can be a contact or a company. This really is only an issue when dealing with searching. A contact for name has a Salutation, FirstName, LastName, MiddleName, Suffix while a company might have CompanyName and DBAName. Both are customers however their "name" structure is entirely different. Would you then put all of those fields on the Entity table and leave some null depending on the EntityTypeID? I can see going with a Name1 and Name2 column on the Entity table and those fields have different meanings based on the EntityTypeID. Thoughts?

|||

It is not really an OO design, it is a common database thing. In your case, if you do mean a customer, which can be a person or a company, then yes, this is a valid thing to do. However, I am not so sure I wouldn't make the user choose the subtype before doing a search, since it is pretty unlikely that they wouldn't know if they were looking for one or the other.

I might also do the search in each table seperate from one another, perhaps in different connections from your UI. Either way I would certainly not create generic columns for names, as that would make the design harder to use, and I wouldn't put the names in the customer table with nulls where values don't quite work because then the searching issues are exactly the same (perhaps worse) than with two tables.

Otherwise, like I said before, I would add a name column to the customer table that was managed by a trigger on the child tables. So I would populate the customer.name column with person.firstName + ' ' + person.lastName (or something like it) for persons, and company.name for the companies, if you really need to search both in a single statement.

|||

Stark77 wrote:

I agree that a function will work however when it comes to searching based on name the function is going to scan which obviously wouldn't be good.

I don't think SQL Server has function-based indexes like Oracle, however you might be able to create an indexed view that includes the function as a column.

if you schemabind your function and your view (the view will have to be pretty simple) then this may allow you to create an indexed view, which is similar to a materialized view in Oracle, and that may help your performance.

worth a try if you haven't thought of this option.

Another option would be to use a trigger to denormalize the correct name into the parent table.

Wednesday, March 7, 2012

only utilising one processor

i have just set up a sql server on a new windows server 2003. the server has 4x xeon smp's on it. if i look at performance monitor it only seems to be utilising one. any ideas as to where i can find answers ?
thanks.
Well, what kind of queries are you running? Many queries cannot be run in
parallel, so they can only queue on one CPU.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:D54A605D-332D-46CE-ADB6-4EF585571365@.microsoft.com...
>i have just set up a sql server on a new windows server 2003. the server
>has 4x xeon smp's on it. if i look at performance monitor it only seems to
>be utilising one. any ideas as to where i can find answers ?
> thanks.
|||Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.server:341487
Hi
You don't say what version of SQL server you are using, this can determine
the number of processes being used see:
http://msdn.microsoft.com/library/de...ar_ts_8dbn.asp
If you have changed the processor affinity then it may favour the one
processor.
You may also be restricted on the number of processors you can use by your
licence.
John
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:D54A605D-332D-46CE-ADB6-4EF585571365@.microsoft.com...
> i have just set up a sql server on a new windows server 2003. the server
has 4x xeon smp's on it. if i look at performance monitor it only seems to
be utilising one. any ideas as to where i can find answers ?
> thanks.
|||"Well, what kind of queries are you running? Many queries cannot be run in parallel, so they can only queue on one CPU."
Is "DBCC CHECKDB" a reliable exception, for those who want to test? (Unless you use trace flag 2528, which prevents CHECKDB going multi-processor.)
AIUI, any simple (single-table) query will use only one processor. (And that not much, I suppose, if all it's doing is pulling data from disk and passing it to the network.)
|||the queries are fairly intensive number crunching operations that use #temp tables, sp's calling other sp's etc.
|||hi john,
i'm using sql server 2000. affinity as set in em is to use all cpu's. 4x physical and 4x logical. i'm using standard edition ( i know there is a limitation on it using only 4x cpu's.) but if you could elaborate more on the licensing restrictions i would a
ppreciate it.
|||hi robert. thanks for your reply. most operations are multi table joins/updates on a #temptable. after all data has been changed etc. it get's inserted into a static table.
|||Hi Mike
See http://www.microsoft.com/sql/howtobuy/default.asp for the types of
licences.
John
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:2DF4B315-3791-42FA-B8F9-214F438A04ED@.microsoft.com...
> hi john,
> i'm using sql server 2000. affinity as set in em is to use all cpu's. 4x
physical and 4x logical. i'm using standard edition ( i know there is a
limitation on it using only 4x cpu's.) but if you could elaborate more on
the licensing restrictions i would appreciate it.

only utilising one processor

i have just set up a sql server on a new windows server 2003. the server has
4x xeon smp's on it. if i look at performance monitor it only seems to be u
tilising one. any ideas as to where i can find answers ?
thanks.Well, what kind of queries are you running? Many queries cannot be run in
parallel, so they can only queue on one CPU.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:D54A605D-332D-46CE-ADB6-4EF585571365@.microsoft.com...
>i have just set up a sql server on a new windows server 2003. the server
>has 4x xeon smp's on it. if i look at performance monitor it only seems to
>be utilising one. any ideas as to where i can find answers ?
> thanks.|||Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.server:341487
Hi
You don't say what version of SQL server you are using, this can determine
the number of processes being used see:
http://msdn.microsoft.com/library/d...br />
8dbn.asp
If you have changed the processor affinity then it may favour the one
processor.
You may also be restricted on the number of processors you can use by your
licence.
John
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:D54A605D-332D-46CE-ADB6-4EF585571365@.microsoft.com...
> i have just set up a sql server on a new windows server 2003. the server
has 4x xeon smp's on it. if i look at performance monitor it only seems to
be utilising one. any ideas as to where i can find answers ?
> thanks.|||"Well, what kind of queries are you running? Many queries cannot be run in
parallel, so they can only queue on one CPU."
Is "DBCC CHECKDB" a reliable exception, for those who want to test? (Unless
you use trace flag 2528, which prevents CHECKDB going multi-processor.)
AIUI, any simple (single-table) query will use only one processor. (And tha
t not much, I suppose, if all it's doing is pulling data from disk and passi
ng it to the network.)|||the queries are fairly intensive number crunching operations that use #temp
tables, sp's calling other sp's etc.|||hi john,
i'm using sql server 2000. affinity as set in em is to use all cpu's. 4x phy
sical and 4x logical. i'm using standard edition ( i know there is a limitat
ion on it using only 4x cpu's.) but if you could elaborate more on the licen
sing restrictions i would a
ppreciate it.|||hi robert. thanks for your reply. most operations are multi table joins/upda
tes on a #temptable. after all data has been changed etc. it get's inserted
into a static table.|||Hi Mike
See http://www.microsoft.com/sql/howtobuy/default.asp for the types of
licences.
John
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:2DF4B315-3791-42FA-B8F9-214F438A04ED@.microsoft.com...
> hi john,
> i'm using sql server 2000. affinity as set in em is to use all cpu's. 4x
physical and 4x logical. i'm using standard edition ( i know there is a
limitation on it using only 4x cpu's.) but if you could elaborate more on
the licensing restrictions i would appreciate it.

only utilising one processor

i have just set up a sql server on a new windows server 2003. the server has 4x xeon smp's on it. if i look at performance monitor it only seems to be utilising one. any ideas as to where i can find answers
thanks.Well, what kind of queries are you running? Many queries cannot be run in
parallel, so they can only queue on one CPU.
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:D54A605D-332D-46CE-ADB6-4EF585571365@.microsoft.com...
>i have just set up a sql server on a new windows server 2003. the server
>has 4x xeon smp's on it. if i look at performance monitor it only seems to
>be utilising one. any ideas as to where i can find answers ?
> thanks.|||Hi
You don't say what version of SQL server you are using, this can determine
the number of processes being used see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/architec/8_ar_ts_8dbn.asp
If you have changed the processor affinity then it may favour the one
processor.
You may also be restricted on the number of processors you can use by your
licence.
John
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:D54A605D-332D-46CE-ADB6-4EF585571365@.microsoft.com...
> i have just set up a sql server on a new windows server 2003. the server
has 4x xeon smp's on it. if i look at performance monitor it only seems to
be utilising one. any ideas as to where i can find answers ?
> thanks.|||"Well, what kind of queries are you running? Many queries cannot be run in parallel, so they can only queue on one CPU.
Is "DBCC CHECKDB" a reliable exception, for those who want to test? (Unless you use trace flag 2528, which prevents CHECKDB going multi-processor.
AIUI, any simple (single-table) query will use only one processor. (And that not much, I suppose, if all it's doing is pulling data from disk and passing it to the network.)|||the queries are fairly intensive number crunching operations that use #temp tables, sp's calling other sp's etc.|||hi john
i'm using sql server 2000. affinity as set in em is to use all cpu's. 4x physical and 4x logical. i'm using standard edition ( i know there is a limitation on it using only 4x cpu's.) but if you could elaborate more on the licensing restrictions i would appreciate it.|||hi robert. thanks for your reply. most operations are multi table joins/updates on a #temptable. after all data has been changed etc. it get's inserted into a static table.|||Hi Mike
See http://www.microsoft.com/sql/howtobuy/default.asp for the types of
licences.
John
"mike" <anonymous@.discussions.microsoft.com> wrote in message
news:2DF4B315-3791-42FA-B8F9-214F438A04ED@.microsoft.com...
> hi john,
> i'm using sql server 2000. affinity as set in em is to use all cpu's. 4x
physical and 4x logical. i'm using standard edition ( i know there is a
limitation on it using only 4x cpu's.) but if you could elaborate more on
the licensing restrictions i would appreciate it.