Showing posts with label dear. Show all posts
Showing posts with label dear. Show all posts

Wednesday, March 28, 2012

Max Function - But between a fixed value and a column

Dear Sirs / Ladies
In HQL their was a MAX Function that would compare a fixed value
( 1.95 ) with a Column.
An example is MAX( 1.95, RegularBasePrice )
If the RegularBasePrice was 0.95 it would return 1.95 or
If the RegularBasePrice was 2.49 it would return 2.49
Is their anyway to duplicate that in TSQL
Below is an example of the code under HQL
from Item;
where CurrentUnitCost > 0
and CurrentPrice > 0;
update CurrentMargin : ( ( ( CurrentPrice /
Max( 1, CurrentSplit ) ) - CurrentUnitCost ) /
Max( .01, ( CurrentPrice /
Max( 1, CurrentSplit ) ) ) ) * 100;
MarkThis is also the GREATEST( <exp list> ) function in Oracle.In Standard
SQL, you will need a CASE expression like this:
CASE WHEN x > 1.95 THEN x ELSE 1.95 END

max degree of parallelism Option

Dear all,
What is the ideal value for "max degree of parallelism" if we have very long
running queries which eat up lots of resources in peak hours.
We have 4 processors Dell machine. Our last DBA recommended it to 4 but new
DBA suggests it to set it to 1.
Need your expert opinion.
Kay
The only way to see what is best is to test each of them. It depends a lot
on what you are doing, schemas etc. It could be any of them.
Andrew J. Kelly SQL MVP
"Kay" <CallDBA@.hotmail.com> wrote in message
news:OPcIup92FHA.2800@.TK2MSFTNGP10.phx.gbl...
> Dear all,
> What is the ideal value for "max degree of parallelism" if we have very
> long running queries which eat up lots of resources in peak hours.
> We have 4 processors Dell machine. Our last DBA recommended it to 4 but
> new DBA suggests it to set it to 1.
> Need your expert opinion.
> Kay
>
|||On Fri, 28 Oct 2005 21:12:47 +0500, Kay wrote:

> Dear all,
> What is the ideal value for "max degree of parallelism" if we have very long
> running queries which eat up lots of resources in peak hours.
> We have 4 processors Dell machine. Our last DBA recommended it to 4 but new
> DBA suggests it to set it to 1.
> Need your expert opinion.
> Kay
Hello,
Just to add a few things.
If you have hyperthreading procs, MS recommends to set the max degree of p.
to the number of physical procs. Ref here :
http://support.microsoft.com/default.aspx/kb/322385
Look also at the evolution over time of CXPACKET wait types ( DBCC SQLPERF
(waitstats) ), indicating if parallelized queries wait for their threads to
finish.
Look also, on the CPUs, the percentage of Kernel Time. That could give you
a hint if the parallelism is detrimental. E.g. if decreasing your maxdop
show a drop of the kernel time, that could be a good thing.
But as it was said, a good answer is, try not to have very long running
queries at peak hours...
sql

max degree of parallelism Option

Dear all,
What is the ideal value for "max degree of parallelism" if we have very long
running queries which eat up lots of resources in peak hours.
We have 4 processors Dell machine. Our last DBA recommended it to 4 but new
DBA suggests it to set it to 1.
Need your expert opinion.
Kay
On Fri, 28 Oct 2005 21:12:47 +0500, "Kay" <CallDBA@.hotmail.com> wrote:
>What is the ideal value for "max degree of parallelism" if we have very long
>running queries which eat up lots of resources in peak hours.
>We have 4 processors Dell machine. Our last DBA recommended it to 4 but new
>DBA suggests it to set it to 1.
>Need your expert opinion.
If you have hyperthreading turned on, you may have 8!
Well, y'know, I guess it's obvious, but you don't really want to have
long-running queries during peak hours, do you? There are various
tuning things you can do, but that's more a matter of design and
operations management.
J.

max degree of parallelism Option

Dear all,
What is the ideal value for "max degree of parallelism" if we have very long
running queries which eat up lots of resources in peak hours.
We have 4 processors Dell machine. Our last DBA recommended it to 4 but new
DBA suggests it to set it to 1.
Need your expert opinion.
KayOn Fri, 28 Oct 2005 21:12:47 +0500, "Kay" <CallDBA@.hotmail.com> wrote:
>What is the ideal value for "max degree of parallelism" if we have very long
>running queries which eat up lots of resources in peak hours.
>We have 4 processors Dell machine. Our last DBA recommended it to 4 but new
>DBA suggests it to set it to 1.
>Need your expert opinion.
If you have hyperthreading turned on, you may have 8!
Well, y'know, I guess it's obvious, but you don't really want to have
long-running queries during peak hours, do you? There are various
tuning things you can do, but that's more a matter of design and
operations management.
J.

max degree of parallelism Option

Dear all,
What is the ideal value for "max degree of parallelism" if we have very long
running queries which eat up lots of resources in peak hours.
We have 4 processors Dell machine. Our last DBA recommended it to 4 but new
DBA suggests it to set it to 1.
Need your expert opinion.
KayThe only way to see what is best is to test each of them. It depends a lot
on what you are doing, schemas etc. It could be any of them.
--
Andrew J. Kelly SQL MVP
"Kay" <CallDBA@.hotmail.com> wrote in message
news:OPcIup92FHA.2800@.TK2MSFTNGP10.phx.gbl...
> Dear all,
> What is the ideal value for "max degree of parallelism" if we have very
> long running queries which eat up lots of resources in peak hours.
> We have 4 processors Dell machine. Our last DBA recommended it to 4 but
> new DBA suggests it to set it to 1.
> Need your expert opinion.
> Kay
>|||On Fri, 28 Oct 2005 21:12:47 +0500, Kay wrote:
> Dear all,
> What is the ideal value for "max degree of parallelism" if we have very long
> running queries which eat up lots of resources in peak hours.
> We have 4 processors Dell machine. Our last DBA recommended it to 4 but new
> DBA suggests it to set it to 1.
> Need your expert opinion.
> Kay
Hello,
Just to add a few things.
If you have hyperthreading procs, MS recommends to set the max degree of p.
to the number of physical procs. Ref here :
http://support.microsoft.com/default.aspx/kb/322385
Look also at the evolution over time of CXPACKET wait types ( DBCC SQLPERF
(waitstats) ), indicating if parallelized queries wait for their threads to
finish.
Look also, on the CPUs, the percentage of Kernel Time. That could give you
a hint if the parallelism is detrimental. E.g. if decreasing your maxdop
show a drop of the kernel time, that could be a good thing.
But as it was said, a good answer is, try not to have very long running
queries at peak hours...

max degree of parallelism Option

Dear all,
What is the ideal value for "max degree of parallelism" if we have very long
running queries which eat up lots of resources in peak hours.
We have 4 processors Dell machine. Our last DBA recommended it to 4 but new
DBA suggests it to set it to 1.
Need your expert opinion.
KayThe only way to see what is best is to test each of them. It depends a lot
on what you are doing, schemas etc. It could be any of them.
Andrew J. Kelly SQL MVP
"Kay" <CallDBA@.hotmail.com> wrote in message
news:OPcIup92FHA.2800@.TK2MSFTNGP10.phx.gbl...
> Dear all,
> What is the ideal value for "max degree of parallelism" if we have very
> long running queries which eat up lots of resources in peak hours.
> We have 4 processors Dell machine. Our last DBA recommended it to 4 but
> new DBA suggests it to set it to 1.
> Need your expert opinion.
> Kay
>|||On Fri, 28 Oct 2005 21:12:47 +0500, Kay wrote:

> Dear all,
> What is the ideal value for "max degree of parallelism" if we have very lo
ng
> running queries which eat up lots of resources in peak hours.
> We have 4 processors Dell machine. Our last DBA recommended it to 4 but ne
w
> DBA suggests it to set it to 1.
> Need your expert opinion.
> Kay
Hello,
Just to add a few things.
If you have hyperthreading procs, MS recommends to set the max degree of p.
to the number of physical procs. Ref here :
http://support.microsoft.com/default.aspx/kb/322385
Look also at the evolution over time of CXPACKET wait types ( DBCC SQLPERF
(waitstats) ), indicating if parallelized queries wait for their threads to
finish.
Look also, on the CPUs, the percentage of Kernel Time. That could give you
a hint if the parallelism is detrimental. E.g. if decreasing your maxdop
show a drop of the kernel time, that could be a good thing.
But as it was said, a good answer is, try not to have very long running
queries at peak hours...

max degree of parallelism Option

Dear all,
What is the ideal value for "max degree of parallelism" if we have very long
running queries which eat up lots of resources in peak hours.
We have 4 processors Dell machine. Our last DBA recommended it to 4 but new
DBA suggests it to set it to 1.
Need your expert opinion.
KayOn Fri, 28 Oct 2005 21:12:47 +0500, "Kay" <CallDBA@.hotmail.com> wrote:
>What is the ideal value for "max degree of parallelism" if we have very lon
g
>running queries which eat up lots of resources in peak hours.
>We have 4 processors Dell machine. Our last DBA recommended it to 4 but new
>DBA suggests it to set it to 1.
>Need your expert opinion.
If you have hyperthreading turned on, you may have 8!
Well, y'know, I guess it's obvious, but you don't really want to have
long-running queries during peak hours, do you? There are various
tuning things you can do, but that's more a matter of design and
operations management.
J.sql

Monday, February 20, 2012

Master..sysaltfiles contains incorrect info

Dear all,
I had a database which contained 2 log files, one of the log files was
deleted - however, master..sysaltfiles still shows 2 log files in
existance...
The database is open, and working OK, so second log file is definately not
being used ( it no longer exists on disk)...
So how do I update master..sysaltfiles to be correct ?
I restarted SQL Server, did not resolve issue ( ie sysaltfiles still shows 2
files) . I'm loathe to do a direct delete on master..sysaltfiles until I can
discover if this kind of 'corruption' is not unknown... but do I have any
other choice ?
Hi
I don't know why you have got the extra entry, was there any message in the
SQL Server log when you re-started?
What happens when you try to remove the file using:
ALTER DATABASE database REMOVE FILE logical_file_name
John
"SteveH" <SteveH@.discussions.microsoft.com> wrote in message
news:7C75A085-7563-4D94-9E50-353ECAFF820B@.microsoft.com...
> Dear all,
> I had a database which contained 2 log files, one of the log files was
> deleted - however, master..sysaltfiles still shows 2 log files in
> existance...
> The database is open, and working OK, so second log file is definately not
> being used ( it no longer exists on disk)...
> So how do I update master..sysaltfiles to be correct ?
> I restarted SQL Server, did not resolve issue ( ie sysaltfiles still shows
> 2
> files) . I'm loathe to do a direct delete on master..sysaltfiles until I
> can
> discover if this kind of 'corruption' is not unknown... but do I have any
> other choice ?

Master..sysaltfiles contains incorrect info

Dear all,
I had a database which contained 2 log files, one of the log files was
deleted - however, master..sysaltfiles still shows 2 log files in
existance...
The database is open, and working OK, so second log file is definately not
being used ( it no longer exists on disk)...
So how do I update master..sysaltfiles to be correct ?
I restarted SQL Server, did not resolve issue ( ie sysaltfiles still shows 2
files) . I'm loathe to do a direct delete on master..sysaltfiles until I can
discover if this kind of 'corruption' is not unknown... but do I have any
other choice ?Hi
I don't know why you have got the extra entry, was there any message in the
SQL Server log when you re-started?
What happens when you try to remove the file using:
ALTER DATABASE database REMOVE FILE logical_file_name
John
"SteveH" <SteveH@.discussions.microsoft.com> wrote in message
news:7C75A085-7563-4D94-9E50-353ECAFF820B@.microsoft.com...
> Dear all,
> I had a database which contained 2 log files, one of the log files was
> deleted - however, master..sysaltfiles still shows 2 log files in
> existance...
> The database is open, and working OK, so second log file is definately not
> being used ( it no longer exists on disk)...
> So how do I update master..sysaltfiles to be correct ?
> I restarted SQL Server, did not resolve issue ( ie sysaltfiles still shows
> 2
> files) . I'm loathe to do a direct delete on master..sysaltfiles until I
> can
> discover if this kind of 'corruption' is not unknown... but do I have any
> other choice ?

Master..sysaltfiles contains incorrect info

Dear all,
I had a database which contained 2 log files, one of the log files was
deleted - however, master..sysaltfiles still shows 2 log files in
existance...
The database is open, and working OK, so second log file is definately not
being used ( it no longer exists on disk)...
So how do I update master..sysaltfiles to be correct ?
I restarted SQL Server, did not resolve issue ( ie sysaltfiles still shows 2
files) . I'm loathe to do a direct delete on master..sysaltfiles until I can
discover if this kind of 'corruption' is not unknown... but do I have any
other choice ?Hi
I don't know why you have got the extra entry, was there any message in the
SQL Server log when you re-started?
What happens when you try to remove the file using:
ALTER DATABASE database REMOVE FILE logical_file_name
John
"SteveH" <SteveH@.discussions.microsoft.com> wrote in message
news:7C75A085-7563-4D94-9E50-353ECAFF820B@.microsoft.com...
> Dear all,
> I had a database which contained 2 log files, one of the log files was
> deleted - however, master..sysaltfiles still shows 2 log files in
> existance...
> The database is open, and working OK, so second log file is definately not
> being used ( it no longer exists on disk)...
> So how do I update master..sysaltfiles to be correct ?
> I restarted SQL Server, did not resolve issue ( ie sysaltfiles still shows
> 2
> files) . I'm loathe to do a direct delete on master..sysaltfiles until I
> can
> discover if this kind of 'corruption' is not unknown... but do I have any
> other choice ?