Showing posts with label bol. Show all posts
Showing posts with label bol. Show all posts

Monday, March 26, 2012

Hints

I am kind of confused about the way SQL Server 2000 handles the hints
that users supply with their SQL statements.

>From BOL, it seems that one can specify them with "WITH (...)" clauses
in SQL statements known as table hints. Sometimes, multiple uses of
this form in a statement is OK. Then there is the OPTION clause for
specifying statement hints. However, the documentation on OPTION
section discourages their use.

Being relatively new to SQL Server and still learning about it, what is
the general practice? Use hints or not? And if so, how (through WITH
or OPTION clauses)?

Cheers!<newtophp2000@.yahoo.com> wrote in message
news:1104122591.142300.19090@.f14g2000cwb.googlegro ups.com...
> I am kind of confused about the way SQL Server 2000 handles the hints
> that users supply with their SQL statements.
> >From BOL, it seems that one can specify them with "WITH (...)" clauses
> in SQL statements known as table hints. Sometimes, multiple uses of
> this form in a statement is OK. Then there is the OPTION clause for
> specifying statement hints. However, the documentation on OPTION
> section discourages their use.
> Being relatively new to SQL Server and still learning about it, what is
> the general practice? Use hints or not? And if so, how (through WITH
> or OPTION clauses)?

Generally, "don't".

Usually SQL server will make better guesses than you can.

> Cheers!|||>> what is the general practice? Use hints or not? <<

1) "Trust in the Optimizer, Luke!" It is usually smarter than you are.
What happens when you give a bad hint?

2) Once you write a query with a hint, that hint stays there. Even if
the pathological situation that made you use a hint heals up. Nobody
will dare remove it later, since it looks important.

3) Every product that supports hints has a different syntax and
underlying model, so your hint code will not port, and the logic of
your hint might not port either.

For example, in Sybase SQL Anywhere, you can give a guess as to what
percentage of the time a predicate will be TRUE. Their optimizer uses
that guess instead of it own computation to build the query. It is not
forced to use a particlar index or method. like other products.|||--CELKO-- wrote:

> 2) Once you write a query with a hint, that hint stays there. Even if
> the pathological situation that made you use a hint heals up. Nobody
> will dare remove it later, since it looks important.

That's funny! And too true!

Zach|||(newtophp2000@.yahoo.com) writes:
> I am kind of confused about the way SQL Server 2000 handles the hints
> that users supply with their SQL statements.
> From BOL, it seems that one can specify them with "WITH (...)" clauses
> in SQL statements known as table hints. Sometimes, multiple uses of
> this form in a statement is OK. Then there is the OPTION clause for
> specifying statement hints. However, the documentation on OPTION
> section discourages their use.
> Being relatively new to SQL Server and still learning about it, what is
> the general practice? Use hints or not? And if so, how (through WITH
> or OPTION clauses)?

Be very conservative with adding hints. In an ideal you would never have to
use them, but today I add two hints to one query: one index hint, and one
OPTION clause to turn of parallelism.

My general rule is that I add a hint, if 1) there is an apparent performance
problem and 2) there is an obvious choice of how the query plan should go.
The one hint I am the least conservative is OPTION (MAXDOP 1), because
even if the query would execute faster with parallelism, it will not at
least monopolize all processors in the machine. (And often parallel plans
are more ineffecient than the non-parallel plans.) The hint I am most
conservative of using is the join hint - you dump in a word between
INNER and JOIN, since this use of this hint results in a warning.

Whether to use WITH or OPTION depends on what you want to force. They
serve different purposes, therefore you cannot say that one is better
than the other.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||>> That's funny! And too true! <<

Remember the quote from early UNIX days? "There is nothing more
permanent than a temporary patch!"

Sunday, February 19, 2012

HideMemberIF: Parent vs. Only Child w/ Parent

Even after reading the SQL BOL definitions, I'm unable to actually demonstrate a real-world difference between the "Never", "ParentName" and "Only Child w/ ParentName" settings for the HideMemberIF property with my multi-level hierarchy on it's ragged dimension. Specifically, my hierarchy simply will not hide a member named the same as it's parent, when viewed in VS's Dimension browser window, regardless of the HIdeMemberIF setting chosen. I've not yet loaded SQL 2K5's SP1, and here are my questions:

(1) Could it be that VS's dimension browser and/or cube browser do not support the HideMemberIF property?

(2) If so, has that changed with SP1?

I think I have seen this issue already in AS2000. The HideMemberIf property requires you to fill empty fields with null or a blank. It is only used for empty levels and not for parent and children with the same name. If you update all your empty levels with a blank or null, will that help?

Regards

Thomas Ivarsson

|||

Hi,

this is a weekness in the VS Browser - but the function works as documented. I use it regular in my projects. You need to use a client which is capable to set the "MDX Compatibility" property to the value of two to browse the proper structure. (Excel 2003 with the CubeAnalysis ADDIN is capable - and many othere clients)

See http://msdn2.microsoft.com/en-us/library/ms365406.aspx for further details or http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=653115&SiteID=1

HANNES

|||

This is very encouraging news! Thank you.

Do you know if either

(1) ProClarity 6.1, or

(2) Strategy Companion

support MDX Compatibility = 2 ?

I'll check with the manufacturers myself and reply here with their responses.

Daniel

|||

Dan

Did you get a response from ProClarity? I have the same problem and want to set it to 2.

|||I did not get a response.

HideMemberIF: Parent vs. Only Child w/ Parent

Even after reading the SQL BOL definitions, I'm unable to actually demonstrate a real-world difference between the "Never", "ParentName" and "Only Child w/ ParentName" settings for the HideMemberIF property with my multi-level hierarchy on it's ragged dimension. Specifically, my hierarchy simply will not hide a member named the same as it's parent, when viewed in VS's Dimension browser window, regardless of the HIdeMemberIF setting chosen. I've not yet loaded SQL 2K5's SP1, and here are my questions:

(1) Could it be that VS's dimension browser and/or cube browser do not support the HideMemberIF property?

(2) If so, has that changed with SP1?

I think I have seen this issue already in AS2000. The HideMemberIf property requires you to fill empty fields with null or a blank. It is only used for empty levels and not for parent and children with the same name. If you update all your empty levels with a blank or null, will that help?

Regards

Thomas Ivarsson

|||

Hi,

this is a weekness in the VS Browser - but the function works as documented. I use it regular in my projects. You need to use a client which is capable to set the "MDX Compatibility" property to the value of two to browse the proper structure. (Excel 2003 with the CubeAnalysis ADDIN is capable - and many othere clients)

See http://msdn2.microsoft.com/en-us/library/ms365406.aspx for further details or http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=653115&SiteID=1

HANNES

|||

This is very encouraging news! Thank you.

Do you know if either

(1) ProClarity 6.1, or

(2) Strategy Companion

support MDX Compatibility = 2 ?

I'll check with the manufacturers myself and reply here with their responses.

Daniel

|||

Dan

Did you get a response from ProClarity? I have the same problem and want to set it to 2.

|||I did not get a response.

HideMemberIF: Parent vs. Only Child w/ Parent

Even after reading the SQL BOL definitions, I'm unable to actually demonstrate a real-world difference between the "Never", "ParentName" and "Only Child w/ ParentName" settings for the HideMemberIF property with my multi-level hierarchy on it's ragged dimension. Specifically, my hierarchy simply will not hide a member named the same as it's parent, when viewed in VS's Dimension browser window, regardless of the HIdeMemberIF setting chosen. I've not yet loaded SQL 2K5's SP1, and here are my questions:

(1) Could it be that VS's dimension browser and/or cube browser do not support the HideMemberIF property?

(2) If so, has that changed with SP1?

I think I have seen this issue already in AS2000. The HideMemberIf property requires you to fill empty fields with null or a blank. It is only used for empty levels and not for parent and children with the same name. If you update all your empty levels with a blank or null, will that help?

Regards

Thomas Ivarsson

|||

Hi,

this is a weekness in the VS Browser - but the function works as documented. I use it regular in my projects. You need to use a client which is capable to set the "MDX Compatibility" property to the value of two to browse the proper structure. (Excel 2003 with the CubeAnalysis ADDIN is capable - and many othere clients)

See http://msdn2.microsoft.com/en-us/library/ms365406.aspx for further details or http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=653115&SiteID=1

HANNES

|||

This is very encouraging news! Thank you.

Do you know if either

(1) ProClarity 6.1, or

(2) Strategy Companion

support MDX Compatibility = 2 ?

I'll check with the manufacturers myself and reply here with their responses.

Daniel

|||

Dan

Did you get a response from ProClarity? I have the same problem and want to set it to 2.

|||I did not get a response.

HideMemberIF: Parent vs. Only Child w/ Parent

Even after reading the SQL BOL definitions, I'm unable to actually demonstrate a real-world difference between the "Never", "ParentName" and "Only Child w/ ParentName" settings for the HideMemberIF property with my multi-level hierarchy on it's ragged dimension. Specifically, my hierarchy simply will not hide a member named the same as it's parent, when viewed in VS's Dimension browser window, regardless of the HIdeMemberIF setting chosen. I've not yet loaded SQL 2K5's SP1, and here are my questions:

(1) Could it be that VS's dimension browser and/or cube browser do not support the HideMemberIF property?

(2) If so, has that changed with SP1?

I think I have seen this issue already in AS2000. The HideMemberIf property requires you to fill empty fields with null or a blank. It is only used for empty levels and not for parent and children with the same name. If you update all your empty levels with a blank or null, will that help?

Regards

Thomas Ivarsson

|||

Hi,

this is a weekness in the VS Browser - but the function works as documented. I use it regular in my projects. You need to use a client which is capable to set the "MDX Compatibility" property to the value of two to browse the proper structure. (Excel 2003 with the CubeAnalysis ADDIN is capable - and many othere clients)

See http://msdn2.microsoft.com/en-us/library/ms365406.aspx for further details or http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=653115&SiteID=1

HANNES

|||

This is very encouraging news! Thank you.

Do you know if either

(1) ProClarity 6.1, or

(2) Strategy Companion

support MDX Compatibility = 2 ?

I'll check with the manufacturers myself and reply here with their responses.

Daniel

|||

Dan

Did you get a response from ProClarity? I have the same problem and want to set it to 2.

|||I did not get a response.