Wednesday, March 21, 2012
measuring traffic
how can i measure the inbound/outbound traffic of a certain db?
(bytes sended / received)
thankx
mike schwarzYou can use SQL Server profiler to measure the stats on a specific DB, but
you won't be able to measure bytes sent / received. Open up Profiler on a
test machine so you can view all the available counters without slowing down
your production server. You can measure transactions, RPC calls,
NTUserNames, etc. But only Performance Monitor measures bytes sent/received
and since it's a Windows Tool, not a SQL tool, you won't be able to do it by
database unless you have a machine that has only SQL on it and only one
database in that instance.
Also, check Books Online for more Profiler information.
Hope that helps.
"Mike Schwarz" wrote:
> hi
> how can i measure the inbound/outbound traffic of a certain db?
> (bytes sended / received)
> thankx
> mike schwarz
>
>|||thankx... not helping much... maybe i will write something for my own
listening on port 1433 and sniffnig some packages out
thankx
"Catadmin" <Catadmin@.discussions.microsoft.com> schrieb im Newsbeitrag
news:04E1D671-2A98-479A-A938-DEB842BB3F60@.microsoft.com...
> You can use SQL Server profiler to measure the stats on a specific DB, but
> you won't be able to measure bytes sent / received. Open up Profiler on a
> test machine so you can view all the available counters without slowing
down
> your production server. You can measure transactions, RPC calls,
> NTUserNames, etc. But only Performance Monitor measures bytes
sent/received
> and since it's a Windows Tool, not a SQL tool, you won't be able to do it
by
> database unless you have a machine that has only SQL on it and only one
> database in that instance.
> Also, check Books Online for more Profiler information.
> Hope that helps.
>
> "Mike Schwarz" wrote:
> > hi
> > how can i measure the inbound/outbound traffic of a certain db?
> > (bytes sended / received)
> >
> > thankx
> >
> > mike schwarz
> >
> >
> >
measuring traffic
how can i measure the inbound/outbound traffic of a certain db?
(bytes sended / received)
thankx
mike schwarzYou can use SQL Server profiler to measure the stats on a specific DB, but
you won't be able to measure bytes sent / received. Open up Profiler on a
test machine so you can view all the available counters without slowing down
your production server. You can measure transactions, RPC calls,
NTUserNames, etc. But only Performance Monitor measures bytes sent/received
and since it's a Windows Tool, not a SQL tool, you won't be able to do it by
database unless you have a machine that has only SQL on it and only one
database in that instance.
Also, check Books Online for more Profiler information.
Hope that helps.
"Mike Schwarz" wrote:
> hi
> how can i measure the inbound/outbound traffic of a certain db?
> (bytes sended / received)
> thankx
> mike schwarz
>
>|||thankx... not helping much... maybe i will write something for my own
listening on port 1433 and sniffnig some packages out
thankx
"Catadmin" <Catadmin@.discussions.microsoft.com> schrieb im Newsbeitrag
news:04E1D671-2A98-479A-A938-DEB842BB3F60@.microsoft.com...
> You can use SQL Server profiler to measure the stats on a specific DB, but
> you won't be able to measure bytes sent / received. Open up Profiler on a
> test machine so you can view all the available counters without slowing
down
> your production server. You can measure transactions, RPC calls,
> NTUserNames, etc. But only Performance Monitor measures bytes
sent/received
> and since it's a Windows Tool, not a SQL tool, you won't be able to do it
by[vbcol=seagreen]
> database unless you have a machine that has only SQL on it and only one
> database in that instance.
> Also, check Books Online for more Profiler information.
> Hope that helps.
>
> "Mike Schwarz" wrote:
>
measuring traffic
how can i measure the inbound/outbound traffic of a certain db?
(bytes sended / received)
thankx
mike schwarz
You can use SQL Server profiler to measure the stats on a specific DB, but
you won't be able to measure bytes sent / received. Open up Profiler on a
test machine so you can view all the available counters without slowing down
your production server. You can measure transactions, RPC calls,
NTUserNames, etc. But only Performance Monitor measures bytes sent/received
and since it's a Windows Tool, not a SQL tool, you won't be able to do it by
database unless you have a machine that has only SQL on it and only one
database in that instance.
Also, check Books Online for more Profiler information.
Hope that helps.
"Mike Schwarz" wrote:
> hi
> how can i measure the inbound/outbound traffic of a certain db?
> (bytes sended / received)
> thankx
> mike schwarz
>
>
|||thankx... not helping much... maybe i will write something for my own
listening on port 1433 and sniffnig some packages out
thankx
"Catadmin" <Catadmin@.discussions.microsoft.com> schrieb im Newsbeitrag
news:04E1D671-2A98-479A-A938-DEB842BB3F60@.microsoft.com...
> You can use SQL Server profiler to measure the stats on a specific DB, but
> you won't be able to measure bytes sent / received. Open up Profiler on a
> test machine so you can view all the available counters without slowing
down
> your production server. You can measure transactions, RPC calls,
> NTUserNames, etc. But only Performance Monitor measures bytes
sent/received
> and since it's a Windows Tool, not a SQL tool, you won't be able to do it
by[vbcol=seagreen]
> database unless you have a machine that has only SQL on it and only one
> database in that instance.
> Also, check Books Online for more Profiler information.
> Hope that helps.
>
> "Mike Schwarz" wrote:
sql
Measuring throughput
pipeline it occurred to me that it would be great to be able to measure
throughput (rows/time). Namely, in 2 places:
1. Throughput of a data-flow (admittedly this is available via a
calculation using a rowcount component and the System::ContainerStartTime
variable that I know is coming soon)
2. Throughput of a data-flow component
#2 would be invaluable for finding bottlenecks in a data-flow which is
really what I could have done with today.
My idea for how to accomplish this would be to fire an OnInformation event
containing the information on completion of the data-flow/data-flow
component. That's the easy bit I suppose, actually capturing the throughput
to make it available to the OnInformation event would I guess be the hard
bit.
In the case of #1, perhaps this could be done by the TaskHost container?
Doesnt help with #2 though which is what I really want.
Any thoughts?
-JamieGood suggestions Jamie. Number 1 is an interesting problem, and a couple of approaches come to mind. The taskhost one isn't one of them though, since the task host doesn't even really know about the pipeline. As far as it's concerned, the pipeline is just another task. That's by design.
Number 2 is an interesting approach, and it looks workable too. This is the kind of thing I hope we can take a closer look at in coming versions.
Did you file a DCR for this? If not, please do, then we can track it and consider it when we're looking at features for V.Next.
Thanks,
K|||No problem Track ID 764896465
Measuring the duration of encrypted stored procedure
I am trying to measure the difference in execution between the encrypted
version versus the non-encrypted version of a stored procedure. I found that
in some tries the encrypted version of the stored procedure takes less time
to execute than the unencrypted version!!! (I an using SQL Profiler and a
custom template to store the result in a table, which is on a different sql
server on a different machine).
Any thoughts on why this is happening would be highly appreciated.
Thanks.
Regards,
Soumitra BanerjeeI'm not aware of an reasons the encrypted proc should be any different.
There certainly could be reaons I'm not aware of though...
what types of performance differences are you seeing?
<<
I found that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!!
needless to say... a proc isn't guaranteed to take the same amount of time
every time... are you sure there's a correlation in time based on whether
it's encrypted? Could it simply be that your proc takes different amounts of
time to run based on load on the server or the parameters you're passing in?
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> Hi Everybody,
> I am trying to measure the difference in execution between the encrypted
> version versus the non-encrypted version of a stored procedure. I found
that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!! (I an using SQL Profiler and a
> custom template to store the result in a table, which is on a different
sql
> server on a different machine).
> Any thoughts on why this is happening would be highly appreciated.
> Thanks.
> Regards,
> Soumitra Banerjee
>|||Thanks for the mail. The result of my testing are as follows:
SQL Server was restarted before TRY 1 . After TRY 1 the same stored
procedure is executed 4 times and the time differences are noted using SQL
Profiler.
SET 1
Non Encrypted Version
Encrypted Version
TRY 1 4694
4589.4
TRY 2 635.2
406.2
TRY 3 330
346.2
TRY 4 534
589
TRY 5 357
303.2
SET 2
Non Encrypted Version
Encrypted Version
TRY 1 8439
8435
TRY 2 1350
956
TRY 3 944
856
TRY 4 1014
813
TRY 5 911
792
SET 3
Non Encrypted Version
Encrypted Version
TRY 1 8900
2800
TRY 2 1197
1356
TRY 3 1059
1033
TRY 4 764
1150
TRY 5 1095
1086
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:ubCjbjl#DHA.3232@.TK2MSFTNGP10.phx.gbl...
> I'm not aware of an reasons the encrypted proc should be any different.
> There certainly could be reaons I'm not aware of though...
> what types of performance differences are you seeing?
> <<
> I found that
> time
> needless to say... a proc isn't guaranteed to take the same amount of time
> every time... are you sure there's a correlation in time based on whether
> it's encrypted? Could it simply be that your proc takes different amounts
of
> time to run based on load on the server or the parameters you're passing
in?
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
> news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> that
> time
a
> sql
>|||Soumitra,
Are you using
DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS
between executions, as well as exactly the same parameter set?
If not, you cannot expect similar results.
And, even if you are, you still cannot expect standardized results until
you're working in a sandbox.
Machine load variations are a huge factor.
James Hokes
"Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> Hi Everybody,
> I am trying to measure the difference in execution between the encrypted
> version versus the non-encrypted version of a stored procedure. I found
that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!! (I an using SQL Profiler and a
> custom template to store the result in a table, which is on a different
sql
> server on a different machine).
> Any thoughts on why this is happening would be highly appreciated.
> Thanks.
> Regards,
> Soumitra Banerjee
>
Measuring the duration of encrypted stored procedure
I am trying to measure the difference in execution between the encrypted
version versus the non-encrypted version of a stored procedure. I found that
in some tries the encrypted version of the stored procedure takes less time
to execute than the unencrypted version!!! (I an using SQL Profiler and a
custom template to store the result in a table, which is on a different sql
server on a different machine).
Any thoughts on why this is happening would be highly appreciated.
Thanks.
Regards,
Soumitra BanerjeeI'm not aware of an reasons the encrypted proc should be any different.
There certainly could be reaons I'm not aware of though...
what types of performance differences are you seeing?
<<
I found that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!!
needless to say... a proc isn't guaranteed to take the same amount of time
every time... are you sure there's a correlation in time based on whether
it's encrypted? Could it simply be that your proc takes different amounts of
time to run based on load on the server or the parameters you're passing in?
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> Hi Everybody,
> I am trying to measure the difference in execution between the encrypted
> version versus the non-encrypted version of a stored procedure. I found
that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!! (I an using SQL Profiler and a
> custom template to store the result in a table, which is on a different
sql
> server on a different machine).
> Any thoughts on why this is happening would be highly appreciated.
> Thanks.
> Regards,
> Soumitra Banerjee
>|||Thanks for the mail. The result of my testing are as follows:
SQL Server was restarted before TRY 1 . After TRY 1 the same stored
procedure is executed 4 times and the time differences are noted using SQL
Profiler.
SET 1
Non Encrypted Version
Encrypted Version
TRY 1 4694
4589.4
TRY 2 635.2
406.2
TRY 3 330
346.2
TRY 4 534
589
TRY 5 357
303.2
SET 2
Non Encrypted Version
Encrypted Version
TRY 1 8439
8435
TRY 2 1350
956
TRY 3 944
856
TRY 4 1014
813
TRY 5 911
792
SET 3
Non Encrypted Version
Encrypted Version
TRY 1 8900
2800
TRY 2 1197
1356
TRY 3 1059
1033
TRY 4 764
1150
TRY 5 1095
1086
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:ubCjbjl#DHA.3232@.TK2MSFTNGP10.phx.gbl...
> I'm not aware of an reasons the encrypted proc should be any different.
> There certainly could be reaons I'm not aware of though...
> what types of performance differences are you seeing?
> <<
> I found that
> > in some tries the encrypted version of the stored procedure takes less
> time
> > to execute than the unencrypted version!!!
> >>
> needless to say... a proc isn't guaranteed to take the same amount of time
> every time... are you sure there's a correlation in time based on whether
> it's encrypted? Could it simply be that your proc takes different amounts
of
> time to run based on load on the server or the parameters you're passing
in?
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
> news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> > Hi Everybody,
> >
> > I am trying to measure the difference in execution between the encrypted
> > version versus the non-encrypted version of a stored procedure. I found
> that
> > in some tries the encrypted version of the stored procedure takes less
> time
> > to execute than the unencrypted version!!! (I an using SQL Profiler and
a
> > custom template to store the result in a table, which is on a different
> sql
> > server on a different machine).
> >
> > Any thoughts on why this is happening would be highly appreciated.
> >
> > Thanks.
> > Regards,
> >
> > Soumitra Banerjee
> >
> >
>|||Soumitra,
Are you using
DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS
between executions, as well as exactly the same parameter set?
If not, you cannot expect similar results.
And, even if you are, you still cannot expect standardized results until
you're working in a sandbox.
Machine load variations are a huge factor.
James Hokes
"Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> Hi Everybody,
> I am trying to measure the difference in execution between the encrypted
> version versus the non-encrypted version of a stored procedure. I found
that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!! (I an using SQL Profiler and a
> custom template to store the result in a table, which is on a different
sql
> server on a different machine).
> Any thoughts on why this is happening would be highly appreciated.
> Thanks.
> Regards,
> Soumitra Banerjee
>
Measuring synchronization progress
is there any way to measure the progress of a synchronization operation so as to show a progress bar to the user?
Best regards,
Marcos Ruano
yes, see this excellent article: http://msdn2.microsoft.com/en-us/library/bb380186.aspx - Background Data Synchronization with SQL Server 2005 Compact Edition
|||Thank you ErikEJ. Could you point me to any VB examples or at least a way to transform the 'DoMonitoredBackgroundSync' function in the example to VB?Best regards,
Marcos Ruano.
|||Maybe this (and numerouse others out there) can get you started: http://www.informit.com/articles/article.asp?p=23020&seqNum=4&rl=1|||Thanks a lot again ErikEJ!!.
Best regards,
Marcos Ruano.
Measuring serve uptime
between SQL server start up and shut down. I have created
a stored procedure which runs at server startup and
inserts date and time into a table.Is there some way I can
find the server shutdown time as well.
Thanks,
AnoopCheck the SQL log files.
"Anoop Agarwal" <agarwala@.halcrow.com> wrote in message
news:0a9701c37cfb$8d29d3b0$a301280a@.phx.gbl...
> I am trying to create a report which gives total time
> between SQL server start up and shut down. I have created
> a stored procedure which runs at server startup and
> inserts date and time into a table.Is there some way I can
> find the server shutdown time as well.
> Thanks,
> Anoop|||You can parse the SQL Server log files (not to be confused with the
transaction log files). They are plain text files called ERRORLOG you can
find in the LOG directory of your SQL Server installation. The first line
will give you the server start up time and the last line the server shut
down time.
--
Jacco Schalkwijk MCDBA, MCSD, MCSE
Database Administrator
Eurostop Ltd.
"Anoop Agarwal" <agarwala@.halcrow.com> wrote in message
news:0a9701c37cfb$8d29d3b0$a301280a@.phx.gbl...
> I am trying to create a report which gives total time
> between SQL server start up and shut down. I have created
> a stored procedure which runs at server startup and
> inserts date and time into a table.Is there some way I can
> find the server shutdown time as well.
> Thanks,
> Anoop|||The more I think about it the ErrorLog can't be relied upon. Someone could
have issued sp_cycle_errorlog and manually started a new errorlog.
There is an NT Event written to the EventLog when SQL Stops
17147 :
SQL Server terminating because of system shutdown.
If you could read this informatrion it would be more reliable. I know of a
proc called sp_eventlog but don't know how it works
HTH
Ryan Waight, MCDBA, MCSE
"Ryan Waight" <Ryan_Waight@.nospam.hotmail.com> wrote in message
news:uPLlelQfDHA.944@.TK2MSFTNGP11.phx.gbl...
> TempDB is created each time SQL starts by default. The following code will
> give you the time SQL Started :- select crdate from sysdatabases where
name
> = 'TempDB'
> To establish when SQL was stopped you could try sp_readerrorlog 1 - this
> will show you previous error log, the max time in this file is SQL
shutting
> down
> --
> HTH
> Ryan Waight, MCDBA, MCSE
> "Anoop Agarwal" <agarwala@.halcrow.com> wrote in message
> news:0a9701c37cfb$8d29d3b0$a301280a@.phx.gbl...
> > I am trying to create a report which gives total time
> > between SQL server start up and shut down. I have created
> > a stored procedure which runs at server startup and
> > inserts date and time into a table.Is there some way I can
> > find the server shutdown time as well.
> >
> > Thanks,
> >
> > Anoop
>|||Check the SQLagent.out file?
>--Original Message--
>I am trying to create a report which gives total time
>between SQL server start up and shut down. I have
created
>a stored procedure which runs at server startup and
>inserts date and time into a table.Is there some way I
can
>find the server shutdown time as well.
>Thanks,
>Anoop
>.
>|||Check the SQLagent.out file?
>--Original Message--
>I am trying to create a report which gives total time
>between SQL server start up and shut down. I have
created
>a stored procedure which runs at server startup and
>inserts date and time into a table.Is there some way I
can
>find the server shutdown time as well.
>Thanks,
>Anoop
>.
>sql
Measuring Login Times
server from a web server running IIS 6. Does anyone have any ideas?
I've tried using the Profiler, but I haven't been able to think of a way to
capture this info
TIA
--
MGMGeles wrote:
> I'm looking for a way to measure how long it takes to log into a SQL 2005
> server from a web server running IIS 6. Does anyone have any ideas?
> I've tried using the Profiler, but I haven't been able to think of a way t
o
> capture this info
> TIA
> --
> MG
AFAIK, SQL 2005 tracks only when a login is successful or unsuccessful,
not the time it takes to make the connection. You may need to use a
network sniffer to capture traffic between the servers, if that's what
you're trying to measure.
Stavros
Measuring Login Times
server from a web server running IIS 6. Does anyone have any ideas?
I've tried using the Profiler, but I haven't been able to think of a way to
capture this info
TIA
--
MGMGeles wrote:
> I'm looking for a way to measure how long it takes to log into a SQL 2005
> server from a web server running IIS 6. Does anyone have any ideas?
> I've tried using the Profiler, but I haven't been able to think of a way to
> capture this info
> TIA
> --
> MG
AFAIK, SQL 2005 tracks only when a login is successful or unsuccessful,
not the time it takes to make the connection. You may need to use a
network sniffer to capture traffic between the servers, if that's what
you're trying to measure.
Stavros
Measuring index usage
in a db, in order to determine which ones are getting hit the most and which
may not be getting used at all.
Any suggestions?
Thanks
--
MGMG-
Check out the article below. I think it will get you moving in the right
direction.
http://www.sqlmag.com/Article/Artic...rver_38789.html
--
Thomas
"MGeles" wrote:
> I'm looking for a way to monitor index usage, over time, on all user table
s
> in a db, in order to determine which ones are getting hit the most and whi
ch
> may not be getting used at all.
> Any suggestions?
> Thanks
> --
> MG|||If you are running SQL Server 2005, you can use the new
sys.dm_db_index_operational_stats management view:
http://msdn2.microsoft.com/en-us/library/ms174281.aspx
Ryan Stonecipher
Microsoft Sql Server Storage Engine, DBCC
This posting is provided "AS IS" with no warranties, and confers no rights.
"MGeles" <michael.geles@.thomson.com> wrote in message
news:06668ED5-FCC7-4D62-9169-1F70E936D43B@.microsoft.com...
> I'm looking for a way to monitor index usage, over time, on all user
> tables
> in a db, in order to determine which ones are getting hit the most and
> which
> may not be getting used at all.
> Any suggestions?
> Thanks
> --
> MG|||On Thu, 27 Apr 2006 12:28:16 -0700, "Ryan Stonecipher [MSFT]"
<ryanston@.microsoft.com> wrote:
>If you are running SQL Server 2005, you can use the new
>sys.dm_db_index_operational_stats management view:
>http://msdn2.microsoft.com/en-us/library/ms174281.aspx
Ryan, that is super-kewl!!!
Now, if I could just get the shop to upgrade to Server2003, ...
Josh
Measuring index usage
in a db, in order to determine which ones are getting hit the most and which
may not be getting used at all.
Any suggestions?
Thanks
--
MGMG-
Check out the article below. I think it will get you moving in the right
direction.
http://www.sqlmag.com/Article/ArticleID/38789/sql_server_38789.html
--
Thomas
"MGeles" wrote:
> I'm looking for a way to monitor index usage, over time, on all user tables
> in a db, in order to determine which ones are getting hit the most and which
> may not be getting used at all.
> Any suggestions?
> Thanks
> --
> MG|||If you are running SQL Server 2005, you can use the new
sys.dm_db_index_operational_stats management view:
http://msdn2.microsoft.com/en-us/library/ms174281.aspx
--
Ryan Stonecipher
Microsoft Sql Server Storage Engine, DBCC
This posting is provided "AS IS" with no warranties, and confers no rights.
"MGeles" <michael.geles@.thomson.com> wrote in message
news:06668ED5-FCC7-4D62-9169-1F70E936D43B@.microsoft.com...
> I'm looking for a way to monitor index usage, over time, on all user
> tables
> in a db, in order to determine which ones are getting hit the most and
> which
> may not be getting used at all.
> Any suggestions?
> Thanks
> --
> MG|||On Thu, 27 Apr 2006 12:28:16 -0700, "Ryan Stonecipher [MSFT]"
<ryanston@.microsoft.com> wrote:
>If you are running SQL Server 2005, you can use the new
>sys.dm_db_index_operational_stats management view:
>http://msdn2.microsoft.com/en-us/library/ms174281.aspx
Ryan, that is super-kewl!!!
Now, if I could just get the shop to upgrade to Server2003, ...
Josh
Measuring daily Inserts/updates on a production databse
I want to measure updates/Insertion rate of my databse in order to measure that how percent the databses is booked for insert and update.
can some one can suggest me the mechanism or other resource for doing this work...
thanxs in advance
It is not very clear what kind of data you are hoping to capture.
Perhaps looking at some of the Performance Monitor counters could help.
Perhaps some of the dynamic system views, such as: sys.dm_db_file_space_usage
|||I want to measure/calculate that how many number of Inserts and Updates operated on my database let say AAA|||probably you want to find out the number of transaction per database. Read : http://msdn2.microsoft.com/en-us/library/ms189883.aspx.
Madhu
|||In SQL 2005 you can also look at sys.dm_db_index_operational_stats.sqlMeasuring CPU usage to compile Ad-hoc TSQL
Is there a way to measure the CPU utilization to compiling Ad-Hoc SQL
statements?Hi,
Use profiler and use the event SQL Completed. In the data columns select
CPU.
Thanks
Hari
SQL Server MVP
<raidken@.yahoo.com> wrote in message
news:1159403934.462700.300110@.e3g2000cwe.googlegroups.com...
> SQL Sever gurus,
> Is there a way to measure the CPU utilization to compiling Ad-Hoc SQL
> statements?
>|||Wouldn't that give you more than just the compile time?
SET STATISTICS PROFILE ON or SET STATISTICS TIME ON would give you server
parse and comopile time.
Linchi
"Hari Prasad" wrote:
> Hi,
> Use profiler and use the event SQL Completed. In the data columns select
> CPU.
> Thanks
> Hari
> SQL Server MVP
> <raidken@.yahoo.com> wrote in message
> news:1159403934.462700.300110@.e3g2000cwe.googlegroups.com...
>
>|||I believe that the "SQL Completed" profiler event will return the total
CPU time it took from compiling to executing the SQL statement. In
effect, it will not identify the CPU time taken to compile exclusively.
Is my understanding corrent?
Hari Prasad wrote:[vbcol=seagreen]
> Hi,
> Use profiler and use the event SQL Completed. In the data columns select
> CPU.
> Thanks
> Hari
> SQL Server MVP
> <raidken@.yahoo.com> wrote in message
> news:1159403934.462700.300110@.e3g2000cwe.googlegroups.com...
Measuring CPU usage to compile Ad-hoc TSQL
Is there a way to measure the CPU utilization to compiling Ad-Hoc SQL
statements?Hi,
Use profiler and use the event SQL Completed. In the data columns select
CPU.
Thanks
Hari
SQL Server MVP
<raidken@.yahoo.com> wrote in message
news:1159403934.462700.300110@.e3g2000cwe.googlegroups.com...
> SQL Sever gurus,
> Is there a way to measure the CPU utilization to compiling Ad-Hoc SQL
> statements?
>|||Wouldn't that give you more than just the compile time?
SET STATISTICS PROFILE ON or SET STATISTICS TIME ON would give you server
parse and comopile time.
Linchi
"Hari Prasad" wrote:
> Hi,
> Use profiler and use the event SQL Completed. In the data columns select
> CPU.
> Thanks
> Hari
> SQL Server MVP
> <raidken@.yahoo.com> wrote in message
> news:1159403934.462700.300110@.e3g2000cwe.googlegroups.com...
> > SQL Sever gurus,
> >
> > Is there a way to measure the CPU utilization to compiling Ad-Hoc SQL
> > statements?
> >
>
>|||I believe that the "SQL Completed" profiler event will return the total
CPU time it took from compiling to executing the SQL statement. In
effect, it will not identify the CPU time taken to compile exclusively.
Is my understanding corrent?
Hari Prasad wrote:
> Hi,
> Use profiler and use the event SQL Completed. In the data columns select
> CPU.
> Thanks
> Hari
> SQL Server MVP
> <raidken@.yahoo.com> wrote in message
> news:1159403934.462700.300110@.e3g2000cwe.googlegroups.com...
> > SQL Sever gurus,
> >
> > Is there a way to measure the CPU utilization to compiling Ad-Hoc SQL
> > statements?
> >
Measuring CPU usage to compile Ad-hoc TSQL
Is there a way to measure the CPU utilization to compiling Ad-Hoc SQL
statements?
Hi,
Use profiler and use the event SQL Completed. In the data columns select
CPU.
Thanks
Hari
SQL Server MVP
<raidken@.yahoo.com> wrote in message
news:1159403934.462700.300110@.e3g2000cwe.googlegro ups.com...
> SQL Sever gurus,
> Is there a way to measure the CPU utilization to compiling Ad-Hoc SQL
> statements?
>
|||Wouldn't that give you more than just the compile time?
SET STATISTICS PROFILE ON or SET STATISTICS TIME ON would give you server
parse and comopile time.
Linchi
"Hari Prasad" wrote:
> Hi,
> Use profiler and use the event SQL Completed. In the data columns select
> CPU.
> Thanks
> Hari
> SQL Server MVP
> <raidken@.yahoo.com> wrote in message
> news:1159403934.462700.300110@.e3g2000cwe.googlegro ups.com...
>
>
|||I believe that the "SQL Completed" profiler event will return the total
CPU time it took from compiling to executing the SQL statement. In
effect, it will not identify the CPU time taken to compile exclusively.
Is my understanding corrent?
Hari Prasad wrote:[vbcol=seagreen]
> Hi,
> Use profiler and use the event SQL Completed. In the data columns select
> CPU.
> Thanks
> Hari
> SQL Server MVP
> <raidken@.yahoo.com> wrote in message
> news:1159403934.462700.300110@.e3g2000cwe.googlegro ups.com...
Measuring consecutive years
I work for a charitable organization, am new to this form (and sql programming) and trying to create a flag for unique records indicating the number of consecutive years a donor has given.
I have create a sample db idenifying donor, giving year and total pledges with multiple donor records existing for multiple years having donated.
CREATE TABLE mygifts06 (Donor_id varchar (10), Gift_yr nvarchar (4), Tot_pledges numeric (16,2))
INSERT INTO mygifts06 (Id,Gift_yr,Pledges)
SELECT 155758,2005,15.00 UNION ALL
SELECT 155759,2004,25.00 UNION ALL
SELECT 155758,2004,40.00 UNION ALL
SELECT 155757,2005,100.00 UNION ALL
SELECT 155758,2002,30.00 UNION ALL
SELECT 155758,2001,120.00 UNION ALL
SELECT 155755,2003,15.00 UNION ALL
SELECT 155758,2006,80.00 UNION ALL
SELECT 155757,2003,65.00 UNION ALL
SELECT 155759,2005,400.00
For the above dataset, I am trying to create the following output
Donor_id 2_consec_gifts 3_consec_gifts 4 consec_gifts
--- ----- ----- -----
155755 0 0 0
155757 0 0 0
155758 1 1 0
155759 1 0 0
Do I need to use a cursor for this task? I lack experienced in using cursors is there an alternative method someone could suggest?
Thanks in advance.If you only need 3 columns, this should get you started:
select a.donor_id, a.gift_yr, b.gift_yr, c.gift_yr
from (select donor_id, max(gift_yr) as gift_yr from mygifts06 group by donor_id) a left join
mygifts06 b on a.donor_id = b.donor_id and a.gift_yr = b.gift_yr + 1 left join
mygifts06 c on a.donor_id = c.donor_id and a.gift_yr = c.gift_yr + 2 and b.gift_yr is not null
As a side note, I changed your gift_yr column to int datatype, because it is a little hard to work with as nvarchar.|||Thanks MCrowley. This is useful and does get me started in the right direction :) ...however I need to know whether or not an individual has ever made a 2, 3, 4, etc., years consecutive donations not just in relation to their last gift. So for example 155755 might have not made a donation in the two consecutive years prior to 2003, but they may have donated 3 years straight bewteen 1994 and 1996.
155755 2003 NULL NULL
155757 2005 NULL NULL
155758 2006 2005 2004
155759 2005 2004 NULL
I will keep fiddling with what you have given me. Thanks again.|||Thanks MCrowley. This is useful and does get me started in the right direction :) ...however I need to know whether or not an individual has ever made a 2, 3, 4, etc., years consecutive donations not just in relation to their last gift. So for example 155755 might have not made a donation in the two consecutive years prior to 2003, but they may have donated 3 years straight bewteen 1994 and 1996.
155755 2003 NULL NULL
155757 2005 NULL NULL
155758 2006 2005 2004
155759 2005 2004 NULL
I will keep fiddling with what you have given me. Thanks again.
I'd use a (dreaded) cursor loop of a table select ordered by ID then Year. Declare 2 variables for the highest-delta and current-delta.
Maybe there's a way to do this with a single query but I can't think of it off hand, and a loop would be so much simpler to program. Something simple like this wouldn't take long to run anyway.
To achieve the output you described above, you could create a nice query, but that output doesn't really count the greatest number of CONSECUTIVE years.|||Assuming integer years, try this
select a.Doner_id
,'2_consec_gifts'=max(case when b.Doner_id is null then 0 else 1 end)
,'3_consec_gifts'=max(case when c.Doner_id is null then 0 else 1 end)
,'4_consec_gifts'=max(case when d.Doner_id is null then 0 else 1 end)
from mygifts06 a
left join mygifts06 b on b.Doner_id=a.Doner_id and b.Gift_yr=a.Gift_yr+1
left join mygifts06 c on c.Doner_id=a.Doner_id and b.Gift_yr=a.Gift_yr+1 and c.Gift_yr=a.Gift_yr+2
left join mygifts06 d on d.Doner_id=a.Doner_id and b.Gift_yr=a.Gift_yr+1 and c.Gift_yr=a.Gift_yr+2 and d.Gift_yr=a.Gift_yr+3
group by a.Doner_id
order by a.Doner_id|||This isn't exactly the way that I'd implement a solution (I'd use functions to simplify changes in the definition of "continuous"), but this is a pure SQL, set based solution.CREATE TABLE #tConsecutive (
donor_id INT
, contribution DATETIME
)
INSERT INTO #tConsecutive (
donor_id, contribution
) SELECT 1000, '1960-01-01' UNION
SELECT 1000, '1961-02-01' UNION
SELECT 1000, '1962-03-01' UNION
SELECT 1000, '1963-04-01' UNION
SELECT 1000, '1965-01-01' UNION
SELECT 1000, '1966-02-01' UNION
SELECT 1001, '1971-02-01' UNION
SELECT 1001, '1972-02-01' UNION
SELECT 1001, '1975-01-01'
SELECT b.donor_id, b.contribution, e.contribution
FROM #tConsecutive AS b
JOIN #tConsecutive AS e
ON (e.donor_id = b.donor_id
AND e.contribution = (SELECT Min(y.contribution)
FROM #tConsecutive AS y
WHERE y.donor_id = b.donor_id
AND b.contribution < y.contribution
AND NOT EXISTS (SELECT *
FROM #tConsecutive AS x
WHERE x.donor_id = b.donor_id
AND y.contribution < x.contribution
AND x.contribution <= DateAdd(month, 18, y.contribution))))
WHERE NOT EXISTS (SELECT *
FROM #tConsecutive AS z
WHERE z.donor_id = b.donor_id
AND DateAdd(month, -18, b.contribution) < z.contribution
AND z.contribution < b.contribution)
DROP TABLE #tConsecutiveThe b alias is the beginning of a consecutive range, and the e alias is the end of that range. I used 18 months in order to allow some drift in dates, but you may want to just code a "before" and an "after" function to give you more flexibility.
-PatP|||Thank you both pdreyer & pat, both of your solutions are great and allow me to solve the task at hand. Thanks again for everyone's input. Great forum!
Richard|||Hey Pat;
There is something I am not getting. Since I want to examine consecutive contributions by calendar year, I've adjusted the data slightly to easily inject into your programming model. I've entered actual observation year, and the output correctly displays ID#1001 consecutively giving between 1988 and 1992 and then again between 1994 and 1995. However for ID#1000 is displays incorrectly consecutive giving between 1985 and 1988 -- it should register consecutive gifts between 1987 and 1988 & 1990 and 1991 only with 1985 and 2006 being outliers.
I've tried changing the values in the DATEADD function to 12 but that just seems to make things worse...any thoughts?
Thanks in advance.
CREATE TABLE #tConsecutive (
donor_id INT
, contribution DATETIME
)
INSERT INTO #tConsecutive (
donor_id, contribution
) SELECT 1000, '1985-01-01' UNION
SELECT 1000, '1987-01-01' UNION
SELECT 1000, '1988-01-01' UNION
SELECT 1000, '1990-01-01' UNION
SELECT 1000, '1991-01-01' UNION
SELECT 1000, '2006-01-01' UNION
SELECT 1001, '1988-01-01' UNION
SELECT 1001, '1989-01-01' UNION
SELECT 1001, '1990-01-01' UNION
SELECT 1001, '1991-01-01' UNION
SELECT 1001, '1992-01-01' UNION
SELECT 1001, '1994-01-01' UNION
SELECT 1001, '1995-01-01'
SELECT b.donor_id, b.contribution, e.contribution
FROM #tConsecutive AS b
JOIN #tConsecutive AS e
ON (e.donor_id = b.donor_id
AND e.contribution = (SELECT Min(y.contribution)
FROM #tConsecutive AS y
WHERE y.donor_id = b.donor_id
AND b.contribution < y.contribution
AND NOT EXISTS (SELECT *
FROM #tConsecutive AS x
WHERE x.donor_id = b.donor_id
AND y.contribution < x.contribution
AND x.contribution <= DateAdd(month, 18, y.contribution))))
WHERE NOT EXISTS (SELECT *
FROM #tConsecutive AS z
WHERE z.donor_id = b.donor_id
AND DateAdd(month, -18, b.contribution) < z.contribution
AND z.contribution < b.contribution)
DROP TABLE #tConsecutive|||Check the code in red... It adds a new t alias (for "this") that enumerates the contributions between the beginning and the end.CREATE TABLE #tConsecutive (
donor_id INT
, contribution DATETIME
)
INSERT INTO #tConsecutive (
donor_id, contribution
) SELECT 1000, '1960-01-01' UNION
SELECT 1000, '1961-02-01' UNION
SELECT 1000, '1962-03-01' UNION
SELECT 1000, '1963-04-01' UNION
SELECT 1000, '1965-01-01' UNION
SELECT 1000, '1966-02-01' UNION
SELECT 1001, '1971-02-01' UNION
SELECT 1001, '1972-02-01' UNION
SELECT 1001, '1975-01-01'
SELECT b.donor_id, b.contribution, e.contribution, t.contribution
FROM #tConsecutive AS b
JOIN #tConsecutive AS e
ON (e.donor_id = b.donor_id
AND e.contribution = (SELECT Min(y.contribution)
FROM #tConsecutive AS y
WHERE y.donor_id = b.donor_id
AND b.contribution < y.contribution
AND NOT EXISTS (SELECT *
FROM #tConsecutive AS x
WHERE x.donor_id = b.donor_id
AND y.contribution < x.contribution
AND x.contribution <= DateAdd(month, 18, y.contribution))))
JOIN #tConsecutive AS t
ON (t.donor_id = b.donor_id
AND t.contribution BETWEEN b.contribution AND e.contribution)
WHERE NOT EXISTS (SELECT *
FROM #tConsecutive AS z
WHERE z.donor_id = b.donor_id
AND DateAdd(month, -18, b.contribution) < z.contribution
AND z.contribution < b.contribution)
DROP TABLE #tConsecutive-PatP|||Another piece of genuine delicate art work,the real SQL smarties,man ...superb Pat !!
We always learn a lot from you ...:rolleyes:
Measuring Bandwidth used by SQL server
server on a per database level? Is there any 3rd party tools available that
anyone is aware of. Any ideas would be appreciated.
Thanks,
-RyanMy 2 cents:
I don't think you're going to be able to measure it on a db level. However,
to measure sql server's bandwidth you'd need a network sniffer, isolate the
sql server traffic (be careful of what network libraries you're using, if
only TCP/IP then count packets on TCP port 1433) and do some accounting...
HTH
Argenis
"Ryan" <ryanz(nospam)@.nospamiqmetrix.com> wrote in message
news:OfcaPQ89DHA.3792@.TK2MSFTNGP09.phx.gbl...
> Does anyone know how one can measure the network bandwidth used by sql
> server on a per database level? Is there any 3rd party tools available
that
> anyone is aware of. Any ideas would be appreciated.
> Thanks,
> -Ryan
>sql
Measuring Bandwidth used by SQL server
server on a per database level? Is there any 3rd party tools available that
anyone is aware of. Any ideas would be appreciated.
Thanks,
-RyanMy 2 cents:
I don't think you're going to be able to measure it on a db level. However,
to measure sql server's bandwidth you'd need a network sniffer, isolate the
sql server traffic (be careful of what network libraries you're using, if
only TCP/IP then count packets on TCP port 1433) and do some accounting...
HTH
Argenis
"Ryan" <ryanz(nospam)@.nospamiqmetrix.com> wrote in message
news:OfcaPQ89DHA.3792@.TK2MSFTNGP09.phx.gbl...
> Does anyone know how one can measure the network bandwidth used by sql
> server on a per database level? Is there any 3rd party tools available
that
> anyone is aware of. Any ideas would be appreciated.
> Thanks,
> -Ryan
>