Showing posts with label explain. Show all posts
Showing posts with label explain. Show all posts

Monday, March 19, 2012

Explanation of INDEX(index, index, ...)

Hi everybody,
can someone explain me how to use :
SELECT foo FROM table (INDEX(indexA, indexB, ...))
Thanks,
ThierryBooksOnLine has a very good description of this feature under "index hints".
This should only be used as a last resort though and normally you want the
optimizer to choose the best index to use.
Andrew J. Kelly SQL MVP
"Thierry" <XXthierry_bXX@.ifrance.com> wrote in message
news:439db51f$0$20162$8fcfb975@.news.wanadoo.fr...
> Hi everybody,
> can someone explain me how to use :
> SELECT foo FROM table (INDEX(indexA, indexB, ...))
> Thanks,
> Thierry
>|||just to reiterate what Andrew said: this is a last resort, and one that
should only be used outside of production.
The optimizer is very good at choosing the right plan. When it doesn't,
it is usually due to poorly designed indexes or out of date statistics.
Having auto update stats on helps, but also ("belt and suspenders" as
they say) updating the statistics regularly, based on the frequency of
data changes. e.g., some tables are quite static, so they can be updated
once a month, some may require daily statistics updates.
Thierry wrote:
> Hi everybody,
> can someone explain me how to use :
> SELECT foo FROM table (INDEX(indexA, indexB, ...))
> Thanks,
> Thierry
>|||got it.
Is there some good sites that explain how to properly use indexes and how to
read results from execution plan ?
Also, how should I read values like 280.000 in performance monitor with
counter=Index searches/sec ?
Thanks,
Thierry
"Trey Walpole" <treypole@.newsgroups.nospam> a crit dans le message de news:
uKXf5w0$FHA.2736@.TK2MSFTNGP11.phx.gbl...
> just to reiterate what Andrew said: this is a last resort, and one that
> should only be used outside of production.
> The optimizer is very good at choosing the right plan. When it doesn't, it
> is usually due to poorly designed indexes or out of date statistics.
> Having auto update stats on helps, but also ("belt and suspenders" as they
> say) updating the statistics regularly, based on the frequency of data
> changes. e.g., some tables are quite static, so they can be updated once a
> month, some may require daily statistics updates.
>
> Thierry wrote:|||You may want to start here:
http://www.microsoft.com/sql/techin.../perftuning.asp
Performance WP's
http://www.swynk.com/friends/vandenberg/perfmonitor.asp Perfmon counters
http://www.sql-server-performance.c...mance_audit.asp
Hardware Performance CheckList
http://www.sql-server-performance.c...rmance_tips.asp
SQL 2000 Performance tuning tips
http://www.support.microsoft.com/?id=q224587 Troubleshooting App
Performance
http://msdn.microsoft.com/library/d.../>
on_24u1.asp
Disk Monitoring
http://www.sql-server-performance.c..._showcontig.asp Understanding
DBCC SHOWCONTIG
Andrew J. Kelly SQL MVP
"Thierry" <XXthierry_bXX@.ifrance.com> wrote in message
news:439e9f95$0$6650$8fcfb975@.news.wanadoo.fr...
> got it.
> Is there some good sites that explain how to properly use indexes and how
> to read results from execution plan ?
> Also, how should I read values like 280.000 in performance monitor with
> counter=Index searches/sec ?
> Thanks,
> Thierry
> "Trey Walpole" <treypole@.newsgroups.nospam> a crit dans le message de
> news: uKXf5w0$FHA.2736@.TK2MSFTNGP11.phx.gbl...
>

Explanation

Can anyone explain me this:
""
Your company has recently purchased a new 64-bit SQL
Server 2000 machine with 8 GB of RAM. You are confused
about which of the PAE and AWE settings should be enabled.
How should you configure Windows and SQL Server to utilize
the 8GB of RAM?
""
Can anyone explain me what PAE and AWE settings are?
Thanxs
Both of these are documented in Books Online. I suggest you download the updated version of Books Online,
though:
http://www.microsoft.com/SQL/techinf...00/default.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"claudy" <anonymous@.discussions.microsoft.com> wrote in message news:202d01c42777$e36d5040$a401280a@.phx.gbl...
> Can anyone explain me this:
> ""
> Your company has recently purchased a new 64-bit SQL
> Server 2000 machine with 8 GB of RAM. You are confused
> about which of the PAE and AWE settings should be enabled.
> How should you configure Windows and SQL Server to utilize
> the 8GB of RAM?
> ""
> Can anyone explain me what PAE and AWE settings are?
> Thanxs
>

Explanation

Can anyone explain me this:
""
Your company has recently purchased a new 64-bit SQL
Server 2000 machine with 8 GB of RAM. You are confused
about which of the PAE and AWE settings should be enabled.
How should you configure Windows and SQL Server to utilize
the 8GB of RAM?
""
Can anyone explain me what PAE and AWE settings are?
ThanxsBoth of these are documented in Books Online. I suggest you download the updated version of Books Online,
though:
http://www.microsoft.com/SQL/techinfo/productdoc/2000/default.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"claudy" <anonymous@.discussions.microsoft.com> wrote in message news:202d01c42777$e36d5040$a401280a@.phx.gbl...
> Can anyone explain me this:
> ""
> Your company has recently purchased a new 64-bit SQL
> Server 2000 machine with 8 GB of RAM. You are confused
> about which of the PAE and AWE settings should be enabled.
> How should you configure Windows and SQL Server to utilize
> the 8GB of RAM?
> ""
> Can anyone explain me what PAE and AWE settings are?
> Thanxs
>|||http://www.microsoft.com/sql/64bit/productinfo/SQL64bitAdva
ntages.asp
http://www.microsoft.com/windows2000/en/advanced/help/defau
lt.asp?url=/windows2000/en/advanced/help/paex86_1.htm
>--Original Message--
>Can anyone explain me this:
>""
>Your company has recently purchased a new 64-bit SQL
>Server 2000 machine with 8 GB of RAM. You are confused
>about which of the PAE and AWE settings should be
enabled.
>How should you configure Windows and SQL Server to
utilize
>the 8GB of RAM?
>""
>Can anyone explain me what PAE and AWE settings are?
>Thanxs
>.
>

Explanation

Can anyone explain me this:
""
Your company has recently purchased a new 64-bit SQL
Server 2000 machine with 8 GB of RAM. You are confused
about which of the PAE and AWE settings should be enabled.
How should you configure Windows and SQL Server to utilize
the 8GB of RAM?
""
Can anyone explain me what PAE and AWE settings are?
ThanxsBoth of these are documented in Books Online. I suggest you download the upd
ated version of Books Online,
though:
http://www.microsoft.com/SQL/techin...000/default.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"claudy" <anonymous@.discussions.microsoft.com> wrote in message news:202d01c42777$e36d5040$a
401280a@.phx.gbl...
> Can anyone explain me this:
> ""
> Your company has recently purchased a new 64-bit SQL
> Server 2000 machine with 8 GB of RAM. You are confused
> about which of the PAE and AWE settings should be enabled.
> How should you configure Windows and SQL Server to utilize
> the 8GB of RAM?
> ""
> Can anyone explain me what PAE and AWE settings are?
> Thanxs
>

Explaining Importance to End Users

Hello Experts at Microsoft.

I am thinking of an easy way to explain importance to Marketers without going into the math. This is what i came up with so far. Does this sound correct to you guys?

Reasoning:

IMPORTANCE = Log(Improvement)

Improvement=P(X&Y)/(P(x)*P(y))

Improvement= (Probability 2 products are sold together)/(random chance 2 products are sold together)

If the (Probability 2 products are sold together) = (random chance 2 products are sold together) then Improvement=1. The log(1) = 0

IMPORTANCE SCORE
-2 to -1 10 to 100 times less likely than random chance
-1 to 0 0 to 10 times less likely than random chance
0 to 1 0 to 10 times more likely than random chance
1 to 2 10 to 100 times more likely than random chance
2 to 3 100 to 1000 times more likely than random chance
3 to 4 1000 to 10000 times more likely than random chance
4 to 5 10000 to 100000 times more likely than random chance
5 to 6 100000 to 1000000 times more likely than random chance
6 to 7 1000000 to 10000000 times more likely than random chance

I should build a set of tables that contain a set o values with your parameters, all inserted in Excel and I should make some charts on these tables.

And , visually, I should have the next dialogues (monologues):

"See this chart, if the Improvement grow up the Importance is as you see " etc...

Explaining Importance to End Users

Hello Experts at Microsoft.

I am thinking of an easy way to explain importance to Marketers without going into the math. This is what i came up with so far. Does this sound correct to you guys?

Reasoning:

IMPORTANCE = Log(Improvement)

Improvement=P(X&Y)/(P(x)*P(y))

Improvement= (Probability 2 products are sold together)/(random chance 2 products are sold together)

If the (Probability 2 products are sold together) = (random chance 2 products are sold together) then Improvement=1. The log(1) = 0

IMPORTANCE SCORE
-2 to -1 10 to 100 times less likely than random chance
-1 to 0 0 to 10 times less likely than random chance
0 to 1 0 to 10 times more likely than random chance
1 to 2 10 to 100 times more likely than random chance
2 to 3 100 to 1000 times more likely than random chance
3 to 4 1000 to 10000 times more likely than random chance
4 to 5 10000 to 100000 times more likely than random chance
5 to 6 100000 to 1000000 times more likely than random chance
6 to 7 1000000 to 10000000 times more likely than random chance

I should build a set of tables that contain a set o values with your parameters, all inserted in Excel and I should make some charts on these tables.

And , visually, I should have the next dialogues (monologues):

"See this chart, if the Improvement grow up the Importance is as you see " etc...

Explain xp_cmdshell

I've got some questions about xp_cmdshell and was hoping someone could explain some things to me. I've written a trigger for a table that uses 'xp_cmdshell' to launch a VB.Net application. The syntax is correct and it "seems" to work but in the way I intended. When the app launches there is no GUI present but when I check the task list I see that the exe has been launched. This intrigued me so I started playing with it in Query Analyzer. When I run the command

exec master.dbo.xp_cmdshell 'C:\WINDOWS\system32\notepad.exe'

I seen a process for notepad show up on my processes list started by 'system' as opposed to myself and notepad still doesn't open up for me to see. I also noticed that the query executes until I kill that particular process. I'm guessing cause it's waiting on the tranaction to complete. What I want to know though is why can't I see the program when I open like this? Is it because 'system' is the user behind it or is there some extra parameter to throw in the xp_cmdshell?

It's stuck because the process is waiting for notepad to complete, which it never will on it's own.

You can't see it, because frankly, you don't own that process, nor does it run within the context of your desktop. SQL Server is a service, it starts before you even log into the machine, and windows can have many users logged in at once (Terminal Services, remote desktop, quick user switching, etc). If a service were to want to show a UI, to whom should it show it? What if there are no users logged in at all?

If all you want to do is notify the logged in users on the machine (or a particular user on your network) that an event has occurred, use net send, or your can write your own "net send"-like clients.

|||What I'm hoping to achieve is have a SQL trigger launch a VB.Net console app that uploads the newly inserted data to an AS400 database. I had originally thought a DTS would be most appropriate but that idea didn't seem to work out so I thought I would write a small console app to do this. Whenever I run the app myself it works out fine, but whenever the trigger lanches the app it just sits in the process list indefinately. If you have any suggestions I'm all ears.|||

I have worked for a bank that uses xp_cmdshell to do the opposite of what you want; the DTS package takes deposits in DB2 AS400 and populates SQL Server database used for bank at home. No I did not write the package all I know it works because I have run SQL Server Profiler on the package and watched it work for four hours. The only thing different is SQL Server Agent runs with Domain Admin permissions and the SQL Server running the Agent runs without a database. The data is not immediate but it runs without problems. Hope this helps.

explain XML as datasource in reporting services

Hi,

its new for me to use XML as datasource and webservices. Can you please explain below snippets

<Query>
<SoapAction>http://tempuri.org/GetDataset</SoapAction>
<Method Namespace="http://tempuri.org/" Name="GetDataset">
<Parameters>
<Parameter Name="sql" Type="String">
<DefaultValue>Select * From Customers</DefaultValue>
</Parameter>

</Parameters>
</Method>

<ElementPath IgnoreNamespaces="true">GetDatasetResponse{}/GetDatasetResult{}/diffgram{}/NewDataSet{}/Results</ElementPath>
</Query>

Read this article below

http://www.codeproject.com/cs/webservices/myservice.asp

|||

Hi,

The code you provide are queries for Datasets with XML Data Sources, a dataset includes a query, which is the command text that runs against a data source to retrieve a specific result set. The result set maps to the collection of fields in a dataset. You can also set filter values on the dataset to limit results returned from the data source. The following are possible XML Query elements:

XML data source

Required XML elementsOptional XML ElementsFor a Web service<Method Namespace="namespace" Name="MethodName" />-- or --<SoapAction>soap action</SoapAction><ElementPath> element path </ElementPath><Method Namespace="namespace" Name="MethodName" />-- or --<SoapAction>soap action</SoapAction>For an XML document<ElementPath> element path </ElementPath>For an embedded XML document<XmlData> inner XML </XmlData><ElementPath> element path </ElementPath>-- or --<ElementPath IgnoreNamespaces="true"> element path </ElementPath>

Besides, here are some materials for you.

Step-by-step instructions on how to retrieve XML data for a Reporting Services report using the XML data processing extension
http://msdn2.microsoft.com/en-us/library/ms345334.aspx

Defining Report Datasets for XML Data
http://msdn2.microsoft.com/en-us/library/ms159741.aspx


Thanks.

EXPLAIN Verb

I have a DB2 SQL background.
Is there something similar to the "EXPLAIN" verb in Microsoft SQL Server
that will allow me to analyze a SQL statement and determine its access path,
etc., and determine how efficient the SQL is?
Let me know.
Thanks in advance.Run the query in Query Analyzer and turn on options like Show Execution
Plan, Show Server Trace, Show Client Statistics. You can also save the
query as a .sql file and give it to the database engine tuning advisor.
"wnfisba" <wnfisba@.discussions.microsoft.com> wrote in message
news:BD207A57-4F6D-4543-9691-32466B165BA1@.microsoft.com...
>I have a DB2 SQL background.
> Is there something similar to the "EXPLAIN" verb in Microsoft SQL Server
> that will allow me to analyze a SQL statement and determine its access
> path,
> etc., and determine how efficient the SQL is?
> Let me know.
> Thanks in advance.
>|||In addition to what Aaron suggests, look up SET SHOWPLAN_ALL in Books Online
.
ML
http://milambda.blogspot.com/|||Just like on DB2 too, there are sql tuning tools like SQL Optimizer for
Visual Studio. You can check it out at
http://www.extensibles.com/modules...=Products&op=NS
examnotes <wnfisba@.discussions.microsoft.com> wrote in
news:BD207A57-4F6D-4543-9691-32466B165BA1@.microsoft.com:

> I have a DB2 SQL background.
> Is there something similar to the "EXPLAIN" verb in Microsoft SQL
> Server that will allow me to analyze a SQL statement and determine its
> access path, etc., and determine how efficient the SQL is?
> Let me know.
> Thanks in advance.
>
The Relentless One
Debugging is a state of mind
http://www.extensibles.com/|||Jeez. quit spamming the boards...
Stu|||Yep, he's relentless.
Nomen est omen.
ML
http://milambda.blogspot.com/

Explain TSQL running

All,
I found this script in one FIDONET conference and decided to test my servers
available around. The result is more than strange.
-- TSQL
DECLARE @.i INT,@.j INT
SET @.j=0
SET @.i=0
WHILE @.i <= 3000000
BEGIN
IF @.i > 100
SET @.j = @.j+100
IF @.i < 300
SET @.j = @.j-200
IF (@.i%6) = 3
SET @.j = 356
IF @.i%37 = 7
SET @.j = @.j + 343
SET @.i=@.i+1
END
SELECT @.j
I installed MSSQL Server 2000 on another machine on my home LAN, then logged
in from the Enterprise Manager, started the Query Analyzer for the LAN
machine from my local machine and finally started this script - 36 seconds,
the local CPU load was about 100% for one of two processors, totally 50%.
Then I closed the Query Analyzer and reopened it on my local machine - same
script - 5 minutes and 39 seconds, the CPU load was about 5-7%. That's very
strange how MSSQL Server works. If I start the script on my local machine it
looks like it works on the LAN machine, but when I start the same script on
the LAN machine it runs on my own local machine. It can't be a mistake.
Maybe I'm missing something, but I got an illusion if we run some script
it's not necessarily will be running on the machine where it should be.
Finally I started the same script against our production server through the
Internet - I suspect the the CPU load was about 1-2% for this task because
it was finished in 24:31, almost 25 minutes!
I'm not using a SQL Server cluster at home for sure, but I can't understand
that. I tested three times with the same result up to one second. The
machines on my LAN are having almost the same configuraion with only couple
differences - my local machine is a Sager (500P) laptop with 1 gig memory,
(LAN) remote (ASUSTeK P4C800 Deluxe motherboard) machine is a desktop with 2
gigs, the processors in both cases are IP 3.2HT, FBS 800, etc. The laptop
CPU has 512 kbytes internal cache, the LAN machine has 1 meg internal cache.
The other parameters are not significant for this case.
The MSSQL Server settings are same for both cases.
Maybe it's just a bug and I shouldn't pay an attention? But why the Query
Analyzer uses the wrong machine when I start the SQL Script? Configuration
problems? All servers are configured in the Enterprise Manager by their
IPs,SqlPort and it shouldn't be a mistake, my home IPs are static.
The funny thing that I saw the same reports in this FIDONET group, when the
script was started locally the CPU load was in some cases from 1-2 to 5-7%
and the duration of this script was very different, like in my case.
So, bug or feature?!
Just D.
Just D. wrote:

> All,
> I found this script in one FIDONET conference and decided to test my servers
> available around. The result is more than strange.
> -- TSQL
> DECLARE @.i INT,@.j INT
> SET @.j=0
> SET @.i=0
> WHILE @.i <= 3000000
> BEGIN
> IF @.i > 100
> SET @.j = @.j+100
> IF @.i < 300
> SET @.j = @.j-200
> IF (@.i%6) = 3
> SET @.j = 356
> IF @.i%37 = 7
> SET @.j = @.j + 343
> SET @.i=@.i+1
> END
> SELECT @.j
> I installed MSSQL Server 2000 on another machine on my home LAN, then logged
> in from the Enterprise Manager, started the Query Analyzer for the LAN
> machine from my local machine and finally started this script - 36 seconds,
> the local CPU load was about 100% for one of two processors, totally 50%.
> Then I closed the Query Analyzer and reopened it on my local machine - same
> script - 5 minutes and 39 seconds, the CPU load was about 5-7%. That's very
> strange how MSSQL Server works. If I start the script on my local machine it
> looks like it works on the LAN machine, but when I start the same script on
> the LAN machine it runs on my own local machine. It can't be a mistake.
> Maybe I'm missing something, but I got an illusion if we run some script
> it's not necessarily will be running on the machine where it should be.
> Finally I started the same script against our production server through the
> Internet - I suspect the the CPU load was about 1-2% for this task because
> it was finished in 24:31, almost 25 minutes!
> I'm not using a SQL Server cluster at home for sure, but I can't understand
> that. I tested three times with the same result up to one second. The
> machines on my LAN are having almost the same configuraion with only couple
> differences - my local machine is a Sager (500P) laptop with 1 gig memory,
> (LAN) remote (ASUSTeK P4C800 Deluxe motherboard) machine is a desktop with 2
> gigs, the processors in both cases are IP 3.2HT, FBS 800, etc. The laptop
> CPU has 512 kbytes internal cache, the LAN machine has 1 meg internal cache.
> The other parameters are not significant for this case.
> The MSSQL Server settings are same for both cases.
> Maybe it's just a bug and I shouldn't pay an attention? But why the Query
> Analyzer uses the wrong machine when I start the SQL Script? Configuration
> problems? All servers are configured in the Enterprise Manager by their
> IPs,SqlPort and it shouldn't be a mistake, my home IPs are static.
> The funny thing that I saw the same reports in this FIDONET group, when the
> script was started locally the CPU load was in some cases from 1-2 to 5-7%
> and the duration of this script was very different, like in my case.
> So, bug or feature?!
> Just D.
>
Well, can you explain what do you mean 'script runs on a wrong machine'?
It runs on a server to which QA or whatever client you are using, is connected...
I will check tomorrow how it works
|||I've had a try running local on a SQL Server and from a client PC connecting
to the SQL Server.
When running locally, the CPU usage hits 100%, with the SQL Server process
taking about 70% and the ISQLW taking up the rest.
When running from a client PC, the ISQLW process is working between 10% to
40% and the SQL Server process on the server is running between 40% to 60%.
The question is why is ISQLW so busy. What is it doing ? I thought it just
submitted the batch and sat back waiting got the result. And it doesn't
really improve when you put this into a Stored Procedure.
Al
"Andrey" wrote:

> Just D. wrote:
>
> Well, can you explain what do you mean 'script runs on a wrong machine'?
> It runs on a server to which QA or whatever client you are using, is connected...
> I will check tomorrow how it works
>
|||"Al" <Al@.discussions.microsoft.com> wrote in message
news:A47458DC-7634-4875-962F-2B4F72380D3B@.microsoft.com...
> I've had a try running local on a SQL Server and from a client PC
> connecting
> to the SQL Server.
> When running locally, the CPU usage hits 100%, with the SQL Server process
> taking about 70% and the ISQLW taking up the rest.
> When running from a client PC, the ISQLW process is working between 10% to
> 40% and the SQL Server process on the server is running between 40% to
> 60%.
> The question is why is ISQLW so busy. What is it doing ? I thought it just
> submitted the batch and sat back waiting got the result. And it doesn't
> really improve when you put this into a Stored Procedure.
It's really interesting. It must be something with DBNETLIB dlls.
RADl0PASlV
|||Tried with osql, using Named Pipes and TCP/IP and the same results for both
When running the SQL as a stored procedure or as a batch, osql is quite busy.
"RADl0PASlV" wrote:

> "Al" <Al@.discussions.microsoft.com> wrote in message
> news:A47458DC-7634-4875-962F-2B4F72380D3B@.microsoft.com...
> It's really interesting. It must be something with DBNETLIB dlls.
> RADl0PASlV
>
>
|||Hi Al,
Are you having only one server registered in EM? Do you have a local and
remote one? It would be interesting to repeat the same that I did - one
local server, one serer on LAN and one server on the Internet.
When you were getting 70% did you try to evaluate the IP traffic? Maybe your
machine was pooling the remote server?
Just D.
" <Al@.discussions.microsoft.com> wrote in message
news:A47458DC-7634-4875-962F-2B4F72380D3B@.microsoft.com...
> I've had a try running local on a SQL Server and from a client PC
> connecting
> to the SQL Server.
> When running locally, the CPU usage hits 100%, with the SQL Server process
> taking about 70% and the ISQLW taking up the rest.
> When running from a client PC, the ISQLW process is working between 10% to
> 40% and the SQL Server process on the server is running between 40% to
> 60%.
> The question is why is ISQLW so busy. What is it doing ? I thought it just
> submitted the batch and sat back waiting got the result. And it doesn't
> really improve when you put this into a Stored Procedure.
|||The cause is the NoCount option.
If this is turned off e.g. you're getting the number of rows effect back,
then the client program (ISQLW or OSQL) is quite busy. When it is turned on,
then the client program isn't eating up any CPU cycles.
In the test across the LAN, the two execution times are 1 minute 40 seconds
for SET NOCOUNT OFF, and 30 seconds for SET NOCOUNT ON.
On face value, this is not suprising, except that the query in question only
returns the row count on the final select statement.
Al

> "Al" <Al@.discussions.microsoft.com> wrote in message
> news:A47458DC-7634-4875-962F-2B4F72380D3B@.microsoft.com...
> It's really interesting. It must be something with DBNETLIB dlls.
> RADl0PASlV
>
|||Hi RADl0PASlV,

> It's really interesting. It must be something with DBNETLIB dlls.
Not only that is interesting. I stopped all computers and connections around
and started this test on my machine - the CPU load is 1-2% and that's all!
Why? If I want to do something, then why this MSSQLServer decides itself how
it should use my resources? I have 3.2 HT processor and I allow MSSQL Server
to use both sub-processors, but it doesn't.
Anyway, that's very strange. Placing the same code to the SP doesn't help,
same result, same duration, same CPU Load.
Just D.

Explain temdb please

I understand that tempdb is a "temporary database", but in the real world,
can someone explain:
1)In the real world, when would I use tempdb?
2)Is it imporant that I understand tempdb? - Or is it rarely used?labsRcool@.community.nospan wrote:
> I understand that tempdb is a "temporary database", but in the real world
,
> can someone explain:
> 1)In the real world, when would I use tempdb?
> 2)Is it imporant that I understand tempdb? - Or is it rarely used?
You typically don't "use" tempdb explicitly, unless you are creating
temp tables. When you execute a large query that involves extensive
sorting, grouping, etc, SQL has to store that data somewhere as it's
being manipulated, that's where TEMPDB is used.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks so much!
"Tracy McKibben" wrote:

> labsRcool@.community.nospan wrote:
> You typically don't "use" tempdb explicitly, unless you are creating
> temp tables. When you execute a large query that involves extensive
> sorting, grouping, etc, SQL has to store that data somewhere as it's
> being manipulated, that's where TEMPDB is used.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||Hi
Along with Tracey's reply you may want to read what tempdb is used for in
books online see http://msdn2.microsoft.com/en-us/library/ms190768.aspx, the
system may make use of tempdb without you necessarily knowing, and therefore
sizing and the location of tempdb on heavily used system can be very
important http://msdn2.microsoft.com/en-us/library/ms175527.aspx this is eve
n
more important for SQL 2005 where row level versioning can use it, or if you
use notification services use will be made of tempdb
http://msdn2.microsoft.com/en-us/library/ms345368.aspx Overuse of tempdb by
your application may result in contention.
John
"labsRcool@.community.nospan" wrote:

> I understand that tempdb is a "temporary database", but in the real world
,
> can someone explain:
> 1)In the real world, when would I use tempdb?
> 2)Is it imporant that I understand tempdb? - Or is it rarely used?|||Thanks!
I now have a better understanding regarding this.
Those links are very helpful, thanks for your time!
"John Bell" wrote:
[vbcol=seagreen]
> Hi
> Along with Tracey's reply you may want to read what tempdb is used for in
> books online see http://msdn2.microsoft.com/en-us/library/ms190768.aspx, t
he
> system may make use of tempdb without you necessarily knowing, and therefo
re
> sizing and the location of tempdb on heavily used system can be very
> important http://msdn2.microsoft.com/en-us/library/ms175527.aspx this is e
ven
> more important for SQL 2005 where row level versioning can use it, or if y
ou
> use notification services use will be made of tempdb
> http://msdn2.microsoft.com/en-us/library/ms345368.aspx Overuse of tempdb b
y
> your application may result in contention.
> John
> "labsRcool@.community.nospan" wrote:
>

Explain temdb please

I understand that tempdb is a "temporary database", but in the real world,
can someone explain:
1)In the real world, when would I use tempdb?
2)Is it imporant that I understand tempdb? - Or is it rarely used?labsRcool@.community.nospan wrote:
> I understand that tempdb is a "temporary database", but in the real world,
> can someone explain:
> 1)In the real world, when would I use tempdb?
> 2)Is it imporant that I understand tempdb? - Or is it rarely used?
You typically don't "use" tempdb explicitly, unless you are creating
temp tables. When you execute a large query that involves extensive
sorting, grouping, etc, SQL has to store that data somewhere as it's
being manipulated, that's where TEMPDB is used.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks so much!
"Tracy McKibben" wrote:
> labsRcool@.community.nospan wrote:
> > I understand that tempdb is a "temporary database", but in the real world,
> > can someone explain:
> > 1)In the real world, when would I use tempdb?
> > 2)Is it imporant that I understand tempdb? - Or is it rarely used?
> You typically don't "use" tempdb explicitly, unless you are creating
> temp tables. When you execute a large query that involves extensive
> sorting, grouping, etc, SQL has to store that data somewhere as it's
> being manipulated, that's where TEMPDB is used.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||Hi
Along with Tracey's reply you may want to read what tempdb is used for in
books online see http://msdn2.microsoft.com/en-us/library/ms190768.aspx, the
system may make use of tempdb without you necessarily knowing, and therefore
sizing and the location of tempdb on heavily used system can be very
important http://msdn2.microsoft.com/en-us/library/ms175527.aspx this is even
more important for SQL 2005 where row level versioning can use it, or if you
use notification services use will be made of tempdb
http://msdn2.microsoft.com/en-us/library/ms345368.aspx Overuse of tempdb by
your application may result in contention.
John
"labsRcool@.community.nospan" wrote:
> I understand that tempdb is a "temporary database", but in the real world,
> can someone explain:
> 1)In the real world, when would I use tempdb?
> 2)Is it imporant that I understand tempdb? - Or is it rarely used?|||Thanks!
I now have a better understanding regarding this.
Those links are very helpful, thanks for your time!
"John Bell" wrote:
> Hi
> Along with Tracey's reply you may want to read what tempdb is used for in
> books online see http://msdn2.microsoft.com/en-us/library/ms190768.aspx, the
> system may make use of tempdb without you necessarily knowing, and therefore
> sizing and the location of tempdb on heavily used system can be very
> important http://msdn2.microsoft.com/en-us/library/ms175527.aspx this is even
> more important for SQL 2005 where row level versioning can use it, or if you
> use notification services use will be made of tempdb
> http://msdn2.microsoft.com/en-us/library/ms345368.aspx Overuse of tempdb by
> your application may result in contention.
> John
> "labsRcool@.community.nospan" wrote:
> > I understand that tempdb is a "temporary database", but in the real world,
> > can someone explain:
> > 1)In the real world, when would I use tempdb?
> > 2)Is it imporant that I understand tempdb? - Or is it rarely used?

explain plan

Hello.
Does someone of you know if is there a 'explain plan' like function in SQL
Server (similar to explain plan in Oracle or DB2)
If so then how it works, where stores data and how it can be retrieved?

Best regards
Bagieta
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
dbDeveloper - Multiple databases editor

http://prominentus.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=Query Analyzer will show you the execution plan for SQL statements (choose
Query / Display Estimated Execution Plan) or you can use the SET
SHOWPLAN_TEXT ON statement to return the text of the plan when you execute a
query.

The actual cached plans aren't exposed to be queried directly but you can
see what objects have been cached in the master..syscacheobjects system
table.

--
David Portas
SQL Server MVP
--|||Thank you.
Unfortunately I need those data stored somewhere and something more than
object names.
I'm developing a software that can manages SQL Server so I must do it in
code using sql statements.
Do you know is the Microsoft going to put that functionality in future
releases?
Regards
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
dbDeveloper - Multiple databases editor

http://prominentus.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|||SET SHOWPLAN_ALL presents the same info in a form that may make it easier
for you to extract the various elements of the plan programmatically.

What other infotmation do you need?

--
David Portas
SQL Server MVP
--|||Yes I know but I DONT want to use any of microsoft tools.
Those tools parse results or something and presents them to user.
I want to make the same thing in my application. But no matter what
connection controls I use I cannot use SHOWPLAN function.
That's why I cannot get the necessary information.

> SET SHOWPLAN_ALL presents the same info in a form that may make it easier
> for you to extract the various elements of the plan programmatically.
> What other infotmation do you need?
> --
> David Portas
> SQL Server MVP
> --|||Bagieta (bagieta21@.poczta.onet.pl) writes:
> Yes I know but I DONT want to use any of microsoft tools.
> Those tools parse results or something and presents them to user.
> I want to make the same thing in my application. But no matter what
> connection controls I use I cannot use SHOWPLAN function.
> That's why I cannot get the necessary information.

In such case, I guess you have to cancel the project.

Seroiusly, SET SHOWPLAN_ALL or SET STATISTICS PROFILE are the tools
you can use to get data back about execution plans to SQL Server, and
that is the data you can work on.

One caveate with SHOWPLAN_ALL is that it comes with an implicit
SET NOEXEC ON. If you also want the statement to be executed, you
should use SET STATISTICS PROFILE.

Or could you be more specific why SHOWPLAN/STATISTICS PROFILE is not
good enough for you? There are not much alternatives.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Explain how to set the Total Mem Allocation using /3GB

/3GB switch is used for SQL Enterprise Ed only on Win2k Adv Server, or is it?
Can it be used to increase the Total memory allocation to a process? If so,
how is that process set?
Regards,
Jamie
the switch can be set in boot.ini on Windows 2K Adv.
Or do it using sp_configure 'show advanced options', 1
RECONFIGURE
GO
sp_configure 'awe enabled', 1
Only if your Server has more than 2 GB of RAM
If you use the /PAE in Boot.ini and AWE in SQL 2000 Ent allows SQL
Server 2000 to utilize more than 4 GB memory
Without the /PAE switch SQL Server can only utilize up to 3 GB of
memory.
On Jan 22, 10:17 am, thejamie <theja...@.discussions.microsoft.com>
wrote:
> /3GB switch is used for SQL Enterprise Ed only on Win2k Adv Server, or is it?
> Can it be used to increase the Total memory allocation to a process? If so,
> how is that process set?
> --
> Regards,
> Jamie
|||/3GB is not used for SQL enterprise edition ONLY on Win2K Adv Server. You can
use it on 32-bit SQL2000/2005 enterprise edition with 32-bit Win2K/Win2K5
enterprise edition if you want the buffer pool of your SQL instance to use
more than 2GB of memory. (I only work with the enterprise editions of SQL
Server and Windows, so I can't comment on how it may behave on a
non-enterprise edition)
For some empirical data, see
http://sqlblog.com/blogs/linchi_shea/archive/2007/01/11/awe-and-3gb-an-empirical-picture.aspx.
Linchi
"thejamie" wrote:

> /3GB switch is used for SQL Enterprise Ed only on Win2k Adv Server, or is it?
> Can it be used to increase the Total memory allocation to a process? If so,
> how is that process set?
> --
> Regards,
> Jamie
|||Since it is the Standard SQL Ed, I suspect the AWE does nothing and that the
/3GB already implemented will give me the biggest bang for the buck. THere
is actually 6 GB available on the Windows Advanced Server 2000. The extra
RAM has reduced the cpu load... instead of an 80% RAM usage it is now 31%
but 31% is still, I think, just 2 GB which is as it should be.
Regards,
Jamie
"Linchi Shea" wrote:
[vbcol=seagreen]
> /3GB is not used for SQL enterprise edition ONLY on Win2K Adv Server. You can
> use it on 32-bit SQL2000/2005 enterprise edition with 32-bit Win2K/Win2K5
> enterprise edition if you want the buffer pool of your SQL instance to use
> more than 2GB of memory. (I only work with the enterprise editions of SQL
> Server and Windows, so I can't comment on how it may behave on a
> non-enterprise edition)
> For some empirical data, see
> http://sqlblog.com/blogs/linchi_shea/archive/2007/01/11/awe-and-3gb-an-empirical-picture.aspx.
> Linchi
> "thejamie" wrote:

Explain how to set the Total Mem Allocation using /3GB

/3GB switch is used for SQL Enterprise Ed only on Win2k Adv Server, or is it
?
Can it be used to increase the Total memory allocation to a process? If so,
how is that process set?
--
Regards,
Jamiethe switch can be set in boot.ini on Windows 2K Adv.
Or do it using sp_configure 'show advanced options', 1
RECONFIGURE
GO
sp_configure 'awe enabled', 1
Only if your Server has more than 2 GB of RAM
If you use the /PAE in Boot.ini and AWE in SQL 2000 Ent allows SQL
Server 2000 to utilize more than 4 GB memory
Without the /PAE switch SQL Server can only utilize up to 3 GB of
memory.
On Jan 22, 10:17 am, thejamie <theja...@.discussions.microsoft.com>
wrote:
> /3GB switch is used for SQL Enterprise Ed only on Win2k Adv Server, or is
it?
> Can it be used to increase the Total memory allocation to a process? If
so,
> how is that process set?
> --
> Regards,
> Jamie|||/3GB is not used for SQL enterprise edition ONLY on Win2K Adv Server. You ca
n
use it on 32-bit SQL2000/2005 enterprise edition with 32-bit Win2K/Win2K5
enterprise edition if you want the buffer pool of your SQL instance to use
more than 2GB of memory. (I only work with the enterprise editions of SQL
Server and Windows, so I can't comment on how it may behave on a
non-enterprise edition)
For some empirical data, see
http://sqlblog.com/blogs/linchi_she...>
icture.aspx.
Linchi
"thejamie" wrote:

> /3GB switch is used for SQL Enterprise Ed only on Win2k Adv Server, or is
it?
> Can it be used to increase the Total memory allocation to a process? If
so,
> how is that process set?
> --
> Regards,
> Jamie|||Since it is the Standard SQL Ed, I suspect the AWE does nothing and that the
/3GB already implemented will give me the biggest bang for the buck. THere
is actually 6 GB available on the Windows Advanced Server 2000. The extra
RAM has reduced the cpu load... instead of an 80% RAM usage it is now 31%
but 31% is still, I think, just 2 GB which is as it should be.
--
Regards,
Jamie
"Linchi Shea" wrote:
[vbcol=seagreen]
> /3GB is not used for SQL enterprise edition ONLY on Win2K Adv Server. You
can
> use it on 32-bit SQL2000/2005 enterprise edition with 32-bit Win2K/Win2K5
> enterprise edition if you want the buffer pool of your SQL instance to use
> more than 2GB of memory. (I only work with the enterprise editions of SQL
> Server and Windows, so I can't comment on how it may behave on a
> non-enterprise edition)
> For some empirical data, see
> http://sqlblog.com/blogs/linchi_she...
-picture.aspx.
> Linchi
> "thejamie" wrote:
>

Monday, March 12, 2012

Explain daily snapshot in transactional replication

We are doing a proof of concept of heterogeneous transactional replication
from Sql 2005 to Oracle. I have some questions about the snapshot.
Q1) If the schema at the subscriber has been intitialized why do you need
to have the automatically created daily job that runs the snapshot?
I am concerned what happens if our DB grows to be very large, and sometime
after replication has already been initialized, gets out of sync.
Q2) After the subscriber has been initialized do any further snapshots
transfer over all the data or just what has changed since the previous
snapshot?
Thank you for any replies.
1) The daily snapshot is only run if the subscriber needs it. So the job
will wake up, figure out if any subscribers need the snapshot and go to
sleep if none of them do. If one of them does, it will generate the
snapshot. I am not sure why it is set up to run daily though as opposed to
once a week or something like that.
2) When the snapshot starts a water mark is placed in the distribution
database. All transactions occurring after this watermark are replicated to
the subscriber as transactions. This way after the snapshot is applied and
the distribution agent is run both databases will be identical or
consistent.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"DBAdan" <DBAdan@.discussions.microsoft.com> wrote in message
news:4B776D9B-259D-42FE-853A-FCD51156B353@.microsoft.com...
> We are doing a proof of concept of heterogeneous transactional replication
> from Sql 2005 to Oracle. I have some questions about the snapshot.
> Q1) If the schema at the subscriber has been intitialized why do you need
> to have the automatically created daily job that runs the snapshot?
> I am concerned what happens if our DB grows to be very large, and
> sometime
> after replication has already been initialized, gets out of sync.
> Q2) After the subscriber has been initialized do any further snapshots
> transfer over all the data or just what has changed since the previous
> snapshot?
> Thank you for any replies.
|||I always disable the snapshot job after initialization and run it manually
if needed. It's useful for heterogenous subscribers but generally I have
names ones so this is not relevant, and in your case it seems you have only
1 subscriber so the same applies.
Once the snapshot has applied, only inserts/updates/deletes will replicate,
rather than BCP flat-file data.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .

explain classes involved in SSIS programming

There are many classes involved in SSIS programming. Their relationships, usages and programming are not intuitive to me and hard for me to comprehend. Does anybody know if there is some good articles explaning all these?

thanks

The object model discussion in BOL does a pretty good job of explaining this. Is there something that you want to know that isn't covered there?

Explain

Counter Name: SQL Server General Statistics: User Connections
This shows the number of user connections, not the number of users that
currently are connected to SQL Server. Since the number of users using SQL
Server affects its performance, you may want to keep an eye on this counter.
Can any one let me know the difference between user connections and not the
number of users that currently are connected to SQL Server.
This shows the number of user connections, not the number of users that
currently are connected to SQL Server. Since the number of users using SQL
Server affects its performance, you may want to keep an eye on this counter.
"Rogers" wrote:

> Counter Name: SQL Server General Statistics: User Connections
> This shows the number of user connections, not the number of users that
> currently are connected to SQL Server. Since the number of users using SQL
> Server affects its performance, you may want to keep an eye on this counter.
>
|||In SQL 2000 any SPIDs below 50 are system connections. These are connections
that SQL Server uses to manage the server. Any SPID over 50 is a user
connection but may include things like SQL Agent, DTS etc. The description
below is not the best in my opinion but what it is trying to say is that you
can have a single user (person or application) that may have more than one
connection.
Andrew J. Kelly SQL MVP
"Rogers" <Rogers@.discussions.microsoft.com> wrote in message
news:7C5C92E7-84FF-404F-987E-86A2BA6832B6@.microsoft.com...[vbcol=seagreen]
> Can any one let me know the difference between user connections and not
> the
> number of users that currently are connected to SQL Server.
> This shows the number of user connections, not the number of users that
> currently are connected to SQL Server. Since the number of users using SQL
> Server affects its performance, you may want to keep an eye on this
> counter.
>
> "Rogers" wrote:
|||What I want to ask like in the sp_configure there is user connection, is that
means how many users can connected simultaneously?
"Andrew J. Kelly" wrote:

> In SQL 2000 any SPIDs below 50 are system connections. These are connections
> that SQL Server uses to manage the server. Any SPID over 50 is a user
> connection but may include things like SQL Agent, DTS etc. The description
> below is not the best in my opinion but what it is trying to say is that you
> can have a single user (person or application) that may have more than one
> connection.
> --
> Andrew J. Kelly SQL MVP
>
> "Rogers" <Rogers@.discussions.microsoft.com> wrote in message
> news:7C5C92E7-84FF-404F-987E-86A2BA6832B6@.microsoft.com...
>
>
|||> What I want to ask like in the sp_configure there is user connection, is
that
> means how many users can connected simultaneously?
The Perfmon counter shows the number of users connected to the system. Use
the sp_configure user connections option to specify the maximum number of
simultaneous user connections allowed on SQL Server.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com

Friday, February 24, 2012

Exists and Filter don't play together?

Can anybody explain why the first two queries work, but the last query returns no rows?

--works fine

with

member [Measures].[TestTrue] as True

select {[Measures].[Internet Sales Amount]} on 0,

Exists(

[Product].[Product].[Product].members

,

,"Internet Sales"

)

on 1

from [Adventure Works]

--works fine

with

member [Measures].[TestTrue] as True

select {[Measures].[Internet Sales Amount]} on 0,

Filter([Product].[Product].[Product].members, [Measures].[TestTrue])

on 1

from [Adventure Works]

--DOES NOT WORK! RETURNS NO ROWS

with

member [Measures].[TestTrue] as True

select {[Measures].[Internet Sales Amount]} on 0,

Exists(

Filter([Product].[Product].[Product].members, [Measures].[TestTrue])

,

,"Internet Sales"

)

on 1

from [Adventure Works]

This does look like a bug. The fact that calculated member is used inside Filter, seem to somehow impact Exists (perhaps calculated member stays in the context?). So it's the culprit. Otherwise, Exists and Filter do coexits - for example the following works fine.

with

member [Measures].[TestTrue] as True

select {[Measures].[Internet Sales Amount]} on 0,

Exists(

Filter([Product].[Product].[Product].members, 1>0)

,

,"Internet Sales"

)

on 1

from [Adventure Works]

You probably need to open case with PSS about this bug to get investigation going.

|||

Thanks for confirming my suspicions, Mosha. I just reported this to connect:
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=251425

This bug isn't holding me back at all since I can just replace the Exists with a NonEmpty and it works:

NonEmpty(
Filter([Product].[Product].[Product].members, [Measures].[TestTrue])
,[Measures].[Internet Sales Amount]
)

|||

Please note, that there are couple of semantic difference between Exists(set, measuregroupname) and NonEmpty(set, measure).

1. If you have any calculations applying to (set,measure) intersection, NonEmpty will take them into account, but Exists won't

2. If you have nullable measures in the measuregroup, the rows where measure is NULL are filtered away for NonEmpty, but not for Exists.