Showing posts with label queries. Show all posts
Showing posts with label queries. Show all posts

Tuesday, March 27, 2012

A cursor performance related question

Hi All,
I have 800 K records need to be processed one by one in a large table daily
using cursor way to update the default columns. The rest of queries are only
read information from this table. The records in this table could be very
large later on.
My question is what's the best way to use cursor to duel with this table.
here is my options:
1.Use a BIG cursor to lock all the un-processed records and use a singal
connection from Query Analyzer
2. Try to break /subgroup them with flags and run the same procedure above
with muti-Query Analyzer Connections. Each connection only duel part of the
record set.
I only have one SQL server . The testing result is Option 1 has the best
performance.
Is SQL server not good at running query parallelly with muti-connections? or
I need to improve the SQL server hardware staff by adding more memory ?
Any expert can point me to the right way?
Many Thanks,
Stevenews.microsoft.com (stevenxiu@.yahoo.com) writes:
> I have 800 K records need to be processed one by one in a large table
> daily using cursor way to update the default columns. The rest of
> queries are only read information from this table. The records in this
> table could be very large later on.
> My question is what's the best way to use cursor to duel with this
> table. here is my options:
> 1.Use a BIG cursor to lock all the un-processed records and use a singal
> connection from Query Analyzer
> 2. Try to break /subgroup them with flags and run the same procedure
> above with muti-Query Analyzer Connections. Each connection only duel
> part of the record set.
> I only have one SQL server . The testing result is Option 1 has the best
> performance.
> Is SQL server not good at running query parallelly with
> muti-connections? or I need to improve the SQL server hardware staff by
> adding more memory ?
With only this abstract narrative it is impossible to say very much. One
possibility is that you have poor indexing, cause the multiple connections
to block each other.
To get any accurate response you would need to post:
o CREATE TABLE and CREATE INDEX statements for the table.
o The code for the two options you are using.
o Some background on what the code is actually doing.
However, there is fair chance that the answer is option 0: don't use a
cursor at all, but apply set-based logic. This usually improves performance
with magnitudes.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||"news.microsoft.com" <stevenxiu@.yahoo.com> wrote in message
news:u9WHOCx8FHA.3044@.TK2MSFTNGP10.phx.gbl...
> I have 800 K records need to be processed one by one in a large table
> daily
> using cursor way to update the default columns.
Chances are that you don't need to do it "one by one" and that it will be
more efficient without a cursor. We won't know for sure unless you post a
better description of your problem. See:
http://www.aspfaq.com/etiquette.asp?id=5006
David Portas
SQL Server MVP
--|||Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. Sample data is also a good idea, along with clear
specifications. It is very hard to debug code when you do not let us
see it.
But based on a few decades with SQL, I have written only five cursors
and I know that I could have avoided three of them if I had the CASE
expression back in the old days.
The fact that you do not know the differences between records and rows
tells me your approach is probably not relational and that yoiur
mindset is still stuck in sequential file processing.|||You should avoid using cursors to perform updates. Set-based updates
perform better for a number of reasons:
(1) Set-based updates write to the transaction log more efficiently. Each
update incurs a certain amount of overhead in the transaction log to mark
the start and end of each write to each affected object in the database.
This includes not only writes to the heap or clustered index, but also
writes to each nonclustered index. In addition, if the same index page is
updated more than once during the thousands of individual updates, then that
page will be recorded in the transaction log once for each related update,
causing the log to grow faster than is necessary. Frequent disk allocations
can hugely affect performance. (This last shouldn't be a problem if you
pre-allocate log space.)
(2) With set-based updates, indexes can be updated en-mass--meaning fewer
costly page splits and fewer writes to each affected database object thus
reducing the frequency of disk head ss.
(3) Locking is more efficient. Set-based updates obtain locks on all of the
affected rows before beginning the write, and then release them as soon as
the changes have been committed. Thousands of individual updates requires
the server to go through the process of obtaining each individual exclusive
lock on each individual row. With set-based updates, locks are more likely
to be escalated when necessary, thereby reducing overhead.
(4) With set-based updates, the system is tasked with writing and writing
only. Thousands of individual updates usually means that several additional
reads are interspersed within the writes. This can cause a lot more disk
activity and in particular, a significant increase in costly disk ss.
If you must use a cursor (I'm not of the opinion that they are always bad;
however, they should only be used as a last resort.), then you should cache
the updates in a temp table or table variable and then flush them using
set-based updates. Inserting individual rows into a table with no indexes
(a heap) or appending to a table with only a clustered index performs pretty
well, and if you have enough memory, temp tables and table variables remain
for the most part in memory. (Writes to tempdb are eventually flushed out
to disk, provided the affected rows and objects still exist by the time the
system gets around to initiating the write.) By appending, I mean that
inserts occur in the same order as the clustered index key--that is, with an
ascending index, each row inserted has a key value that is greater than the
key value in any existing row in the table.
"news.microsoft.com" <stevenxiu@.yahoo.com> wrote in message
news:u9WHOCx8FHA.3044@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> I have 800 K records need to be processed one by one in a large table
> daily
> using cursor way to update the default columns. The rest of queries are
> only
> read information from this table. The records in this table could be very
> large later on.
> My question is what's the best way to use cursor to duel with this table.
> here is my options:
> 1.Use a BIG cursor to lock all the un-processed records and use a singal
> connection from Query Analyzer
> 2. Try to break /subgroup them with flags and run the same procedure above
> with muti-Query Analyzer Connections. Each connection only duel part of
> the
> record set.
> I only have one SQL server . The testing result is Option 1 has the best
> performance.
> Is SQL server not good at running query parallelly with muti-connections?
> or
> I need to improve the SQL server hardware staff by adding more memory ?
> Any expert can point me to the right way?
> Many Thanks,
> Steve
>sql

Sunday, March 25, 2012

a couple reporting/ normalization questions

I have one DB in specific that fails to even be in 1NF, much less 3rd. It is
used only for reporting, no OLTP. The queries are quite slow to say the
least. Every day this data is truncated and repopulated from a mainframe.
From what I can tell there are a few options here.
1; Normalize it. The problem here is there are 150+ Stored Procs dependant
on the existing structure, and of course nobody has time to re-write them.
Theres probably software that can do this for us, (?) but if so, does it
really work well? Also, the DTS Package that populates this DB every day
would need total overhauling.
2; Forget this pile of crap. Let it stay how it is for existing stuff. But
have new stuff go into Analysis Services, and then use Reporting Services.
Everyone here want to use AS and RS anyways, so thats the way we are
leaning. The problem is I have little experience with either of these tools.
Im open to the challenge and we move fairly slow anyways, so I think it can
work. Now my questions.
1; Can Reporting Services connect/report from Analysis Services?
2, Can AS be populated from a totally de-normalized DB? Can I design the
cubes how they should be, and take the data from several different tables to
populate them?
3; If #2 isnt hopefull, would I be better off to create a new, well designed
db, populate that, and from there populate AS?
All insights are appreciated.
TIA,
ChrisR
to answer number2
You should use DTS to do this
Create the structure that you think will work for you amd then you can
create your cubes (fact and dimension tables) however you want
http://sqlservercode.blogspot.com/
"ChrisR" wrote:

> I have one DB in specific that fails to even be in 1NF, much less 3rd. It is
> used only for reporting, no OLTP. The queries are quite slow to say the
> least. Every day this data is truncated and repopulated from a mainframe.
> From what I can tell there are a few options here.
> 1; Normalize it. The problem here is there are 150+ Stored Procs dependant
> on the existing structure, and of course nobody has time to re-write them.
> Theres probably software that can do this for us, (?) but if so, does it
> really work well? Also, the DTS Package that populates this DB every day
> would need total overhauling.
> 2; Forget this pile of crap. Let it stay how it is for existing stuff. But
> have new stuff go into Analysis Services, and then use Reporting Services.
> Everyone here want to use AS and RS anyways, so thats the way we are
> leaning. The problem is I have little experience with either of these tools.
> Im open to the challenge and we move fairly slow anyways, so I think it can
> work. Now my questions.
> 1; Can Reporting Services connect/report from Analysis Services?
> 2, Can AS be populated from a totally de-normalized DB? Can I design the
> cubes how they should be, and take the data from several different tables to
> populate them?
> 3; If #2 isnt hopefull, would I be better off to create a new, well designed
> db, populate that, and from there populate AS?
> All insights are appreciated.
> --
> TIA,
> ChrisR
|||Chris,
1. Yes you can use AS as a source of data to RS.
2 & 3. Depends on how the data is structured. A normalized structure to a
denormalized (star or snowflake) structure would be prefered.
HTH
Jerry
"ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
news:BE095EAD-5738-43EC-A2EC-1BF20E837BEF@.microsoft.com...
>I have one DB in specific that fails to even be in 1NF, much less 3rd. It
>is
> used only for reporting, no OLTP. The queries are quite slow to say the
> least. Every day this data is truncated and repopulated from a mainframe.
> From what I can tell there are a few options here.
> 1; Normalize it. The problem here is there are 150+ Stored Procs dependant
> on the existing structure, and of course nobody has time to re-write them.
> Theres probably software that can do this for us, (?) but if so, does it
> really work well? Also, the DTS Package that populates this DB every day
> would need total overhauling.
> 2; Forget this pile of crap. Let it stay how it is for existing stuff. But
> have new stuff go into Analysis Services, and then use Reporting Services.
> Everyone here want to use AS and RS anyways, so thats the way we are
> leaning. The problem is I have little experience with either of these
> tools.
> Im open to the challenge and we move fairly slow anyways, so I think it
> can
> work. Now my questions.
> 1; Can Reporting Services connect/report from Analysis Services?
> 2, Can AS be populated from a totally de-normalized DB? Can I design the
> cubes how they should be, and take the data from several different tables
> to
> populate them?
> 3; If #2 isnt hopefull, would I be better off to create a new, well
> designed
> db, populate that, and from there populate AS?
> All insights are appreciated.
> --
> TIA,
> ChrisR
|||Do both of you mean that I can, or cannot, populate well designed cubes from
my poorly designed tables? I think you are both saying I can, but want to
clarify.
Thanks, ChrisR
"ChrisR" wrote:

> I have one DB in specific that fails to even be in 1NF, much less 3rd. It is
> used only for reporting, no OLTP. The queries are quite slow to say the
> least. Every day this data is truncated and repopulated from a mainframe.
> From what I can tell there are a few options here.
> 1; Normalize it. The problem here is there are 150+ Stored Procs dependant
> on the existing structure, and of course nobody has time to re-write them.
> Theres probably software that can do this for us, (?) but if so, does it
> really work well? Also, the DTS Package that populates this DB every day
> would need total overhauling.
> 2; Forget this pile of crap. Let it stay how it is for existing stuff. But
> have new stuff go into Analysis Services, and then use Reporting Services.
> Everyone here want to use AS and RS anyways, so thats the way we are
> leaning. The problem is I have little experience with either of these tools.
> Im open to the challenge and we move fairly slow anyways, so I think it can
> work. Now my questions.
> 1; Can Reporting Services connect/report from Analysis Services?
> 2, Can AS be populated from a totally de-normalized DB? Can I design the
> cubes how they should be, and take the data from several different tables to
> populate them?
> 3; If #2 isnt hopefull, would I be better off to create a new, well designed
> db, populate that, and from there populate AS?
> All insights are appreciated.
> --
> TIA,
> ChrisR
|||Chris,
It's kinda like asking can I get 'there' from 'here' without being able to
accurately qualify where 'here' is. AS cubes are built off of denormalized
structures (star and snowflake). I'm "somewhat" sure with views and DTS you
can populate the structure tables for the AS cubes or possibly the AS cubes
themselves. Would it be easier if you were working with a normalized design
to start with? Would there be less coding and less possiblity for error?
I'd say yes to both.
HTH
Jerry
"ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
news:1C1291EB-FAD5-41E1-8655-5E3BC7B7B695@.microsoft.com...[vbcol=seagreen]
> Do both of you mean that I can, or cannot, populate well designed cubes
> from
> my poorly designed tables? I think you are both saying I can, but want to
> clarify.
> Thanks, ChrisR
>
> "ChrisR" wrote:
sql

a couple reporting/ normalization questions

I have one DB in specific that fails to even be in 1NF, much less 3rd. It is
used only for reporting, no OLTP. The queries are quite slow to say the
least. Every day this data is truncated and repopulated from a mainframe.
From what I can tell there are a few options here.
1; Normalize it. The problem here is there are 150+ Stored Procs dependant
on the existing structure, and of course nobody has time to re-write them.
Theres probably software that can do this for us, (?) but if so, does it
really work well? Also, the DTS Package that populates this DB every day
would need total overhauling.
2; Forget this pile of crap. Let it stay how it is for existing stuff. But
have new stuff go into Analysis Services, and then use Reporting Services.
Everyone here want to use AS and RS anyways, so thats the way we are
leaning. The problem is I have little experience with either of these tools.
Im open to the challenge and we move fairly slow anyways, so I think it can
work. Now my questions.
1; Can Reporting Services connect/report from Analysis Services?
2, Can AS be populated from a totally de-normalized DB? Can I design the
cubes how they should be, and take the data from several different tables to
populate them?
3; If #2 isnt hopefull, would I be better off to create a new, well designed
db, populate that, and from there populate AS?
All insights are appreciated.
--
TIA,
ChrisRto answer number2
You should use DTS to do this
Create the structure that you think will work for you amd then you can
create your cubes (fact and dimension tables) however you want
http://sqlservercode.blogspot.com/
"ChrisR" wrote:
> I have one DB in specific that fails to even be in 1NF, much less 3rd. It is
> used only for reporting, no OLTP. The queries are quite slow to say the
> least. Every day this data is truncated and repopulated from a mainframe.
> From what I can tell there are a few options here.
> 1; Normalize it. The problem here is there are 150+ Stored Procs dependant
> on the existing structure, and of course nobody has time to re-write them.
> Theres probably software that can do this for us, (?) but if so, does it
> really work well? Also, the DTS Package that populates this DB every day
> would need total overhauling.
> 2; Forget this pile of crap. Let it stay how it is for existing stuff. But
> have new stuff go into Analysis Services, and then use Reporting Services.
> Everyone here want to use AS and RS anyways, so thats the way we are
> leaning. The problem is I have little experience with either of these tools.
> Im open to the challenge and we move fairly slow anyways, so I think it can
> work. Now my questions.
> 1; Can Reporting Services connect/report from Analysis Services?
> 2, Can AS be populated from a totally de-normalized DB? Can I design the
> cubes how they should be, and take the data from several different tables to
> populate them?
> 3; If #2 isnt hopefull, would I be better off to create a new, well designed
> db, populate that, and from there populate AS?
> All insights are appreciated.
> --
> TIA,
> ChrisR|||Chris,
1. Yes you can use AS as a source of data to RS.
2 & 3. Depends on how the data is structured. A normalized structure to a
denormalized (star or snowflake) structure would be prefered.
HTH
Jerry
"ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
news:BE095EAD-5738-43EC-A2EC-1BF20E837BEF@.microsoft.com...
>I have one DB in specific that fails to even be in 1NF, much less 3rd. It
>is
> used only for reporting, no OLTP. The queries are quite slow to say the
> least. Every day this data is truncated and repopulated from a mainframe.
> From what I can tell there are a few options here.
> 1; Normalize it. The problem here is there are 150+ Stored Procs dependant
> on the existing structure, and of course nobody has time to re-write them.
> Theres probably software that can do this for us, (?) but if so, does it
> really work well? Also, the DTS Package that populates this DB every day
> would need total overhauling.
> 2; Forget this pile of crap. Let it stay how it is for existing stuff. But
> have new stuff go into Analysis Services, and then use Reporting Services.
> Everyone here want to use AS and RS anyways, so thats the way we are
> leaning. The problem is I have little experience with either of these
> tools.
> Im open to the challenge and we move fairly slow anyways, so I think it
> can
> work. Now my questions.
> 1; Can Reporting Services connect/report from Analysis Services?
> 2, Can AS be populated from a totally de-normalized DB? Can I design the
> cubes how they should be, and take the data from several different tables
> to
> populate them?
> 3; If #2 isnt hopefull, would I be better off to create a new, well
> designed
> db, populate that, and from there populate AS?
> All insights are appreciated.
> --
> TIA,
> ChrisR|||Do both of you mean that I can, or cannot, populate well designed cubes from
my poorly designed tables? I think you are both saying I can, but want to
clarify.
Thanks, ChrisR
"ChrisR" wrote:
> I have one DB in specific that fails to even be in 1NF, much less 3rd. It is
> used only for reporting, no OLTP. The queries are quite slow to say the
> least. Every day this data is truncated and repopulated from a mainframe.
> From what I can tell there are a few options here.
> 1; Normalize it. The problem here is there are 150+ Stored Procs dependant
> on the existing structure, and of course nobody has time to re-write them.
> Theres probably software that can do this for us, (?) but if so, does it
> really work well? Also, the DTS Package that populates this DB every day
> would need total overhauling.
> 2; Forget this pile of crap. Let it stay how it is for existing stuff. But
> have new stuff go into Analysis Services, and then use Reporting Services.
> Everyone here want to use AS and RS anyways, so thats the way we are
> leaning. The problem is I have little experience with either of these tools.
> Im open to the challenge and we move fairly slow anyways, so I think it can
> work. Now my questions.
> 1; Can Reporting Services connect/report from Analysis Services?
> 2, Can AS be populated from a totally de-normalized DB? Can I design the
> cubes how they should be, and take the data from several different tables to
> populate them?
> 3; If #2 isnt hopefull, would I be better off to create a new, well designed
> db, populate that, and from there populate AS?
> All insights are appreciated.
> --
> TIA,
> ChrisR|||Chris,
It's kinda like asking can I get 'there' from 'here' without being able to
accurately qualify where 'here' is. AS cubes are built off of denormalized
structures (star and snowflake). I'm "somewhat" sure with views and DTS you
can populate the structure tables for the AS cubes or possibly the AS cubes
themselves. Would it be easier if you were working with a normalized design
to start with? Would there be less coding and less possiblity for error?
I'd say yes to both.
HTH
Jerry
"ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
news:1C1291EB-FAD5-41E1-8655-5E3BC7B7B695@.microsoft.com...
> Do both of you mean that I can, or cannot, populate well designed cubes
> from
> my poorly designed tables? I think you are both saying I can, but want to
> clarify.
> Thanks, ChrisR
>
> "ChrisR" wrote:
>> I have one DB in specific that fails to even be in 1NF, much less 3rd. It
>> is
>> used only for reporting, no OLTP. The queries are quite slow to say the
>> least. Every day this data is truncated and repopulated from a mainframe.
>> From what I can tell there are a few options here.
>> 1; Normalize it. The problem here is there are 150+ Stored Procs
>> dependant
>> on the existing structure, and of course nobody has time to re-write
>> them.
>> Theres probably software that can do this for us, (?) but if so, does it
>> really work well? Also, the DTS Package that populates this DB every day
>> would need total overhauling.
>> 2; Forget this pile of crap. Let it stay how it is for existing stuff.
>> But
>> have new stuff go into Analysis Services, and then use Reporting
>> Services.
>> Everyone here want to use AS and RS anyways, so thats the way we are
>> leaning. The problem is I have little experience with either of these
>> tools.
>> Im open to the challenge and we move fairly slow anyways, so I think it
>> can
>> work. Now my questions.
>> 1; Can Reporting Services connect/report from Analysis Services?
>> 2, Can AS be populated from a totally de-normalized DB? Can I design the
>> cubes how they should be, and take the data from several different tables
>> to
>> populate them?
>> 3; If #2 isnt hopefull, would I be better off to create a new, well
>> designed
>> db, populate that, and from there populate AS?
>> All insights are appreciated.
>> --
>> TIA,
>> ChrisR

a couple reporting/ normalization questions

I have one DB in specific that fails to even be in 1NF, much less 3rd. It is
used only for reporting, no OLTP. The queries are quite slow to say the
least. Every day this data is truncated and repopulated from a mainframe.
From what I can tell there are a few options here.
1; Normalize it. The problem here is there are 150+ Stored Procs dependant
on the existing structure, and of course nobody has time to re-write them.
Theres probably software that can do this for us, (?) but if so, does it
really work well? Also, the DTS Package that populates this DB every day
would need total overhauling.
2; Forget this pile of crap. Let it stay how it is for existing stuff. But
have new stuff go into Analysis Services, and then use Reporting Services.
Everyone here want to use AS and RS anyways, so thats the way we are
leaning. The problem is I have little experience with either of these tools.
Im open to the challenge and we move fairly slow anyways, so I think it can
work. Now my questions.
1; Can Reporting Services connect/report from Analysis Services?
2, Can AS be populated from a totally de-normalized DB? Can I design the
cubes how they should be, and take the data from several different tables to
populate them?
3; If #2 isnt hopefull, would I be better off to create a new, well designed
db, populate that, and from there populate AS?
All insights are appreciated.
TIA,
ChrisRto answer number2
You should use DTS to do this
Create the structure that you think will work for you amd then you can
create your cubes (fact and dimension tables) however you want
http://sqlservercode.blogspot.com/
"ChrisR" wrote:

> I have one DB in specific that fails to even be in 1NF, much less 3rd. It
is
> used only for reporting, no OLTP. The queries are quite slow to say the
> least. Every day this data is truncated and repopulated from a mainframe.
> From what I can tell there are a few options here.
> 1; Normalize it. The problem here is there are 150+ Stored Procs dependant
> on the existing structure, and of course nobody has time to re-write them.
> Theres probably software that can do this for us, (?) but if so, does it
> really work well? Also, the DTS Package that populates this DB every day
> would need total overhauling.
> 2; Forget this pile of crap. Let it stay how it is for existing stuff. But
> have new stuff go into Analysis Services, and then use Reporting Services.
> Everyone here want to use AS and RS anyways, so thats the way we are
> leaning. The problem is I have little experience with either of these tool
s.
> Im open to the challenge and we move fairly slow anyways, so I think it ca
n
> work. Now my questions.
> 1; Can Reporting Services connect/report from Analysis Services?
> 2, Can AS be populated from a totally de-normalized DB? Can I design the
> cubes how they should be, and take the data from several different tables
to
> populate them?
> 3; If #2 isnt hopefull, would I be better off to create a new, well design
ed
> db, populate that, and from there populate AS?
> All insights are appreciated.
> --
> TIA,
> ChrisR|||Chris,
1. Yes you can use AS as a source of data to RS.
2 & 3. Depends on how the data is structured. A normalized structure to a
denormalized (star or snowflake) structure would be prefered.
HTH
Jerry
"ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
news:BE095EAD-5738-43EC-A2EC-1BF20E837BEF@.microsoft.com...
>I have one DB in specific that fails to even be in 1NF, much less 3rd. It
>is
> used only for reporting, no OLTP. The queries are quite slow to say the
> least. Every day this data is truncated and repopulated from a mainframe.
> From what I can tell there are a few options here.
> 1; Normalize it. The problem here is there are 150+ Stored Procs dependant
> on the existing structure, and of course nobody has time to re-write them.
> Theres probably software that can do this for us, (?) but if so, does it
> really work well? Also, the DTS Package that populates this DB every day
> would need total overhauling.
> 2; Forget this pile of crap. Let it stay how it is for existing stuff. But
> have new stuff go into Analysis Services, and then use Reporting Services.
> Everyone here want to use AS and RS anyways, so thats the way we are
> leaning. The problem is I have little experience with either of these
> tools.
> Im open to the challenge and we move fairly slow anyways, so I think it
> can
> work. Now my questions.
> 1; Can Reporting Services connect/report from Analysis Services?
> 2, Can AS be populated from a totally de-normalized DB? Can I design the
> cubes how they should be, and take the data from several different tables
> to
> populate them?
> 3; If #2 isnt hopefull, would I be better off to create a new, well
> designed
> db, populate that, and from there populate AS?
> All insights are appreciated.
> --
> TIA,
> ChrisR|||Do both of you mean that I can, or cannot, populate well designed cubes from
my poorly designed tables? I think you are both saying I can, but want to
clarify.
Thanks, ChrisR
"ChrisR" wrote:

> I have one DB in specific that fails to even be in 1NF, much less 3rd. It
is
> used only for reporting, no OLTP. The queries are quite slow to say the
> least. Every day this data is truncated and repopulated from a mainframe.
> From what I can tell there are a few options here.
> 1; Normalize it. The problem here is there are 150+ Stored Procs dependant
> on the existing structure, and of course nobody has time to re-write them.
> Theres probably software that can do this for us, (?) but if so, does it
> really work well? Also, the DTS Package that populates this DB every day
> would need total overhauling.
> 2; Forget this pile of crap. Let it stay how it is for existing stuff. But
> have new stuff go into Analysis Services, and then use Reporting Services.
> Everyone here want to use AS and RS anyways, so thats the way we are
> leaning. The problem is I have little experience with either of these tool
s.
> Im open to the challenge and we move fairly slow anyways, so I think it ca
n
> work. Now my questions.
> 1; Can Reporting Services connect/report from Analysis Services?
> 2, Can AS be populated from a totally de-normalized DB? Can I design the
> cubes how they should be, and take the data from several different tables
to
> populate them?
> 3; If #2 isnt hopefull, would I be better off to create a new, well design
ed
> db, populate that, and from there populate AS?
> All insights are appreciated.
> --
> TIA,
> ChrisR|||Chris,
It's kinda like asking can I get 'there' from 'here' without being able to
accurately qualify where 'here' is. AS cubes are built off of denormalized
structures (star and snowflake). I'm "somewhat" sure with views and DTS you
can populate the structure tables for the AS cubes or possibly the AS cubes
themselves. Would it be easier if you were working with a normalized design
to start with? Would there be less coding and less possiblity for error?
I'd say yes to both.
HTH
Jerry
"ChrisR" <ChrisR@.discussions.microsoft.com> wrote in message
news:1C1291EB-FAD5-41E1-8655-5E3BC7B7B695@.microsoft.com...[vbcol=seagreen]
> Do both of you mean that I can, or cannot, populate well designed cubes
> from
> my poorly designed tables? I think you are both saying I can, but want to
> clarify.
> Thanks, ChrisR
>
> "ChrisR" wrote:
>

Sunday, March 11, 2012

8 concurrent queries?

This occurs many times in our w2k event view application log with various
choices of numbers exceeded by.
What is it referring to and how do I increase the number of concurrent
queries?
Thanks.
17052 :
This SQL Server has been optimized for 8 concurrent queries. This limit has
been exceeded by 10 queries and performance may be adversely affected.This is a multi-part message in MIME format.
--=_NextPart_000_05A6_01C376F0.628EA510
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Sounds like you are using MSDE or SQL Server Personal Edition. If you =want to run a bunch of concurrent queries - without performance =degradation - then you will need to go to SQL Server Standard or =Enterprise Edition.
-- Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Todd A. Carter" <tcarter@.activelinkarts.com> wrote in message =news:ubHAVExdDHA.748@.TK2MSFTNGP10.phx.gbl...
This occurs many times in our w2k event view application log with =various
choices of numbers exceeded by.
What is it referring to and how do I increase the number of concurrent
queries?
Thanks.
17052 :
This SQL Server has been optimized for 8 concurrent queries. This limit =has
been exceeded by 10 queries and performance may be adversely affected.
--=_NextPart_000_05A6_01C376F0.628EA510
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

Sounds like you are using MSDE or SQL =Server Personal Edition. If you want to run a bunch of concurrent queries =- without performance degradation - then you will need to go to SQL Server =Standard or Enterprise Edition.
-- Tom
---T=homas A. Moreau, BSc, PhD, MCSE, MCDBASQL Server MVPColumnist, SQL =Server ProfessionalToronto, ON Canadahttp://www.pinnaclepublishing.com/sql">www.pinnaclepublishing.com=/sql
"Todd A. Carter" wrote in message news:ubHAVExdDHA.748@.T=K2MSFTNGP10.phx.gbl...This occurs many times in our w2k event view application log with =variouschoices of numbers exceeded by.What is it referring to and how do I =increase the number of concurrentqueries?Thanks.17052 :This SQL Server has been optimized for 8 concurrent queries. =This limit hasbeen exceeded by 10 queries and performance may be adversely affected.

--=_NextPart_000_05A6_01C376F0.628EA510--|||What it refers to is that the governor in MSDE (or SQL Server Personal
Edition) has been activated as the result of too many queries being
submitted concurrently. The implication is that the users of MSDE will
experience a slowdown until the number of concurrent queries drops below 8.
If this is a rare event, then I wouldn't worry about it. If you are seeing
this message frequently (as you indicate), then check to see if your users
are experiencing performance problems running the application that is using
MSDE. If they are then you need to purchase and upgrade to SQL Server 2000
Standard Edition. But if your users aren't complaining, then you can just
ignore the messages and keep in mind that should they start complaining
about the performance then you know the likely reason.
--
Hal Berenson, SQL Server MVP
True Mountain Group LLC
"Todd A. Carter" <tcarter@.activelinkarts.com> wrote in message
news:ubHAVExdDHA.748@.TK2MSFTNGP10.phx.gbl...
> This occurs many times in our w2k event view application log with various
> choices of numbers exceeded by.
> What is it referring to and how do I increase the number of concurrent
> queries?
> Thanks.
>
> 17052 :
> This SQL Server has been optimized for 8 concurrent queries. This limit
has
> been exceeded by 10 queries and performance may be adversely affected.
>
>|||It is personal edition. Is there a clean method for
upgrading? We own the software license already.
Todd
>--Original Message--
>Thank you everyone... but this is supposed to be an
Enterprise Server. How
>can I verify/validate that the correct software was
loaded?
>Thanks.
>Todd
>"Hal Berenson" <haroldb@.truemountainconsulting.com>
wrote in message
>news:uJ1v#1ydDHA.560@.tk2msftngp13.phx.gbl...
>> What it refers to is that the governor in MSDE (or SQL
Server Personal
>> Edition) has been activated as the result of too many
queries being
>> submitted concurrently. The implication is that the
users of MSDE will
>> experience a slowdown until the number of concurrent
queries drops below
>8.
>> If this is a rare event, then I wouldn't worry about
it. If you are
>seeing
>> this message frequently (as you indicate), then check
to see if your users
>> are experiencing performance problems running the
application that is
>using
>> MSDE. If they are then you need to purchase and
upgrade to SQL Server
>2000
>> Standard Edition. But if your users aren't
complaining, then you can just
>> ignore the messages and keep in mind that should they
start complaining
>> about the performance then you know the likely reason.
>> --
>> Hal Berenson, SQL Server MVP
>> True Mountain Group LLC
>>
>> "Todd A. Carter" <tcarter@.activelinkarts.com> wrote in
message
>> news:ubHAVExdDHA.748@.TK2MSFTNGP10.phx.gbl...
>> > This occurs many times in our w2k event view
application log with
>various
>> > choices of numbers exceeded by.
>> >
>> > What is it referring to and how do I increase the
number of concurrent
>> > queries?
>> >
>> > Thanks.
>> >
>> >
>> >
>> > 17052 :
>> >
>> > This SQL Server has been optimized for 8 concurrent
queries. This limit
>> has
>> > been exceeded by 10 queries and performance may be
adversely affected.
>> >
>> >
>> >
>>
>
>.
>|||I do not think you can upgrade Personal SQL 2k to Enterprise SQL 2k, only to
Standard and then To Enterprise.
for more Info go here
http://msdn.microsoft.com/library/en-us/instsql/in_overview_2xtf.asp
"Todd A. Carter" <tcarter@.activelinkarts.com> wrote in message
news:001a01c37741$e151cd40$a001280a@.phx.gbl...
> It is personal edition. Is there a clean method for
> upgrading? We own the software license already.
> Todd
> >--Original Message--
> >Thank you everyone... but this is supposed to be an
> Enterprise Server. How
> >can I verify/validate that the correct software was
> loaded?
> >
> >Thanks.
> >
> >Todd
> >
> >"Hal Berenson" <haroldb@.truemountainconsulting.com>
> wrote in message
> >news:uJ1v#1ydDHA.560@.tk2msftngp13.phx.gbl...
> >> What it refers to is that the governor in MSDE (or SQL
> Server Personal
> >> Edition) has been activated as the result of too many
> queries being
> >> submitted concurrently. The implication is that the
> users of MSDE will
> >> experience a slowdown until the number of concurrent
> queries drops below
> >8.
> >> If this is a rare event, then I wouldn't worry about
> it. If you are
> >seeing
> >> this message frequently (as you indicate), then check
> to see if your users
> >> are experiencing performance problems running the
> application that is
> >using
> >> MSDE. If they are then you need to purchase and
> upgrade to SQL Server
> >2000
> >> Standard Edition. But if your users aren't
> complaining, then you can just
> >> ignore the messages and keep in mind that should they
> start complaining
> >> about the performance then you know the likely reason.
> >>
> >> --
> >> Hal Berenson, SQL Server MVP
> >> True Mountain Group LLC
> >>
> >>
> >> "Todd A. Carter" <tcarter@.activelinkarts.com> wrote in
> message
> >> news:ubHAVExdDHA.748@.TK2MSFTNGP10.phx.gbl...
> >> > This occurs many times in our w2k event view
> application log with
> >various
> >> > choices of numbers exceeded by.
> >> >
> >> > What is it referring to and how do I increase the
> number of concurrent
> >> > queries?
> >> >
> >> > Thanks.
> >> >
> >> >
> >> >
> >> > 17052 :
> >> >
> >> > This SQL Server has been optimized for 8 concurrent
> queries. This limit
> >> has
> >> > been exceeded by 10 queries and performance may be
> adversely affected.
> >> >
> >> >
> >> >
> >>
> >>
> >
> >
> >.
> >|||First you need to check your operating system. If it is a desktop operating
system such as Windows XP then you need to upgrade that first as Enterprise
Edition will only install on server operating systems. Then take a look at
the link that Yovan provided. If you can't do a direct upgrade then you can
look at detaching the databases, installing Enterprise Edition, and
re-attaching the databases.
--
Hal Berenson, SQL Server MVP
True Mountain Group LLC
"Todd A. Carter" <tcarter@.activelinkarts.com> wrote in message
news:001a01c37741$e151cd40$a001280a@.phx.gbl...
> It is personal edition. Is there a clean method for
> upgrading? We own the software license already.
> Todd
> >--Original Message--
> >Thank you everyone... but this is supposed to be an
> Enterprise Server. How
> >can I verify/validate that the correct software was
> loaded?
> >
> >Thanks.
> >
> >Todd
> >
> >"Hal Berenson" <haroldb@.truemountainconsulting.com>
> wrote in message
> >news:uJ1v#1ydDHA.560@.tk2msftngp13.phx.gbl...
> >> What it refers to is that the governor in MSDE (or SQL
> Server Personal
> >> Edition) has been activated as the result of too many
> queries being
> >> submitted concurrently. The implication is that the
> users of MSDE will
> >> experience a slowdown until the number of concurrent
> queries drops below
> >8.
> >> If this is a rare event, then I wouldn't worry about
> it. If you are
> >seeing
> >> this message frequently (as you indicate), then check
> to see if your users
> >> are experiencing performance problems running the
> application that is
> >using
> >> MSDE. If they are then you need to purchase and
> upgrade to SQL Server
> >2000
> >> Standard Edition. But if your users aren't
> complaining, then you can just
> >> ignore the messages and keep in mind that should they
> start complaining
> >> about the performance then you know the likely reason.
> >>
> >> --
> >> Hal Berenson, SQL Server MVP
> >> True Mountain Group LLC
> >>
> >>
> >> "Todd A. Carter" <tcarter@.activelinkarts.com> wrote in
> message
> >> news:ubHAVExdDHA.748@.TK2MSFTNGP10.phx.gbl...
> >> > This occurs many times in our w2k event view
> application log with
> >various
> >> > choices of numbers exceeded by.
> >> >
> >> > What is it referring to and how do I increase the
> number of concurrent
> >> > queries?
> >> >
> >> > Thanks.
> >> >
> >> >
> >> >
> >> > 17052 :
> >> >
> >> > This SQL Server has been optimized for 8 concurrent
> queries. This limit
> >> has
> >> > been exceeded by 10 queries and performance may be
> adversely affected.
> >> >
> >> >
> >> >
> >>
> >>
> >
> >
> >.
> >

Thursday, February 16, 2012

5 Database Queries to go with an online purchasing system :-)

Hi Guys,

I'm having trouble thinking of ideas for queries that would go with an online purchasing system. The queries must be partially complex (i.e. not just a simple insert query :p).

I can easily write the queries myself but i just need a little help thinking of useful queries.

A query for an 'Invoice' for example is a perfect idea as it implements table joins etc.

Possible other queries are:
Find all customers that have spent a total of more than X amount
Find all delivery address's that X customer has sent items to
Track an order to see if items have been sent yet or not.
etc...

If anyone else can think of a few other ideas i'd be very grateful :-)

thx for reading :-)

--Philkillsonline purchasing sytem? or homework assignment? ;)

total sales by category for the previous month
average price of backlogged orders (product not in stock)
most popular item (by quantity sold, not total price)|||easiest technique...
open a copy of Access, create yuour tables
create the realtionships
open up the query designer
add the required constraints...
run the query, prove it works
open up the query in SQL mode, copy and paste the SQL to your homework assignment paper
...jobsagoodun

... requires minimum thought and creativity, and absolutely no proof that you have understood the concepts behid joins, where clauses etc...|||online purchasing sytem? or homework assignment? ;)

total sales by category for the previous month
average price of backlogged orders (product not in stock)
most popular item (by quantity sold, not total price)

Some nice ideas there thx ^^

easiest technique...
open a copy of Access, create yuour tables
create the realtionships
open up the query designer
add the required constraints...
run the query, prove it works
open up the query in SQL mode, copy and paste the SQL to your homework assignment paper
...jobsagoodun

... requires minimum thought and creativity, and absolutely no proof that you have understood the concepts behid joins, where clauses etc...

and lol...

a nice way to cheat i suppose... but i do actually understand joins etc ;p|||total sales by category for the previous month
average price of backlogged orders (product not in stock)
most popular item (by quantity sold, not total price)
Variations on these:
- Total sales for all foregoing months
- Top ten most popular items
- Most popular category per client (useful for better direct advertising ;-)
- Top ten clients in terms of the amount spent
- Same question, but now in 12 columns, for each of the last 12 months|||- Customer's year to date sales (purchases) compared with last year's year to date sales (purchases).
:shocked:

Monday, February 13, 2012

4294967296 Tuple limit and 32 bit Architecture

We have repeatedly encountered the 4,294,967,296 tuple limit in our MDX queries, when using the Non Empty Operator on a Cross Join of fields:

Example

WITH

MEMBER [Date].[DateID].[M1] AS

AGGREGATE({[Date].[DateID].&[20070101]:[Date].[DateID].&[20070103]})

SET [M2] AS

({[dimension7].[attribute7].[value7]})

SELECT {[Measures].[count]} ON COLUMNS,

NON EMPTY {([dimension1].[attribute1].Children,[dimension2].[attribute2].Children,[M2],[dimesnsion3].[attribute3].Children,[dimension4].[attribute4].Children,[dimension5].[attribute5].Children,[dimension6].[attribute6].Children)} ON ROWS FROM MyCube WHERE {([Date].[DateID].[M1])}

Error

The expression contains a function that cannot operate on a set with more than 4,294,967,296 tuples.

We have followed Microsoft's best practices for Cube Design, while balancing the needs of our application.

Is it a coincidence that the 4,294,967,296 = 2^32 on the order of 4 GigaBytes and our server is of 32-bit architecture?. Will scaling up to a 64-bit architecture machine help? Then will our tuple limit be 2^64 which is on the order of 18 ExaBytes or 18 qunintllion bytes?

Hi prakal,

the 64 bit would be helpfull for you, but I think, that brut force isn't goot approach.

Do you really need to join all 6 dimensions? Why you didn't try to use nonemptycross join.

You would have your query done on the 32bit box as well.

|||

I don't think 64bit will fix this, I believe the 2^32 is more of an SSAS engine limit, not a platform one. The nonemptycrossjoin is depreciated, but you could nonempty() your attribute sets before crossjoining them.

WITH

MEMBER [Date].[DateID].[M1] AS

AGGREGATE({[Date].[DateID].&[20070101]:[Date].[DateID].&[20070103]})

SET [M2] AS

({[dimension7].[attribute7].[value7]})

SELECT {[Measures].[count]} ON COLUMNS,

NON EMPTY {NONEMPTY([dimension1].[attribute1].Children,[Measures].[count]),NONEMPTY([dimension2].[attribute2].Children,[Measures].[count]),NONEMPTY([M2], [Measures].[count]),NONEMPTY([dimesnsion3].[attribute3].Children, [Measures].[count]),NONEMTPY([dimension4].[attribute4].Children, [Measures].[count]),NONEMPTY([dimension5].[attribute5].Children, [Measures].[count]),NONEMPTY([dimension6].[attribute6].Children,[Measures].[count] )} ON ROWS

FROM MyCube

WHERE {([Date].[DateID].[M1])}

Or, if you had all of these attributes as part of a hierarchy you could just do

WITH

MEMBER [Date].[DateID].[M1] AS

AGGREGATE({[Date].[DateID].&[20070101]:[Date].[DateID].&[20070103]})

SET [M2] AS

({[dimension7].[attribute7].[value7]})

SELECT {[Measures].[count]} ON COLUMNS,

NON EMPTY {[dimension1].[hierarchy1].Members} ON ROWS

FROM MyCube

WHERE {([Date].[DateID].[M1])}

|||

A recent thread on this forum linked to a Microsoft Support article that might be relevant:

Error message when you run a complex MDX query that contains the NON EMPTY clause in SQL Server 2005 Analysis Services: "The expression contains a function that cannot operate on a set with more than 4,294,967,296 tuples"

SYMPTOMS

When you use a user account to connect to an instance of Microsoft SQL Server 2005 Analysis Services, you receive the following error message when you run a complex MDX query:

The expression contains a function that cannot operate on a set with more than 4,294,967,296 tuples.

This problem may occur if the following conditions are true:

? The user account is a member of a role that has dimension security set on a measure. ? The complex MDX query contains the NON EMPTY clause.

Back to the top

CAUSE

This issue occurs because the optimized algorithm for the NON EMPTY clause cannot handle dimension security on measures. Therefore, SQL Server 2005 Analysis Services must use the default algorithm for the NON EMPTY clause. If the query is complex, you may receive the error message that the "Symptoms" section mentions.

|||

Darren,

Thanks for your reply. I tried the query in your first solution, but I get the error "Two sets specified in the function have different dimensionality".

Which I guess answers your second solution, all the attributes in the query are a part of different dimensions and cannot be set as a hierarchy of one dimension.

|||

Sorry, I overlooked the detail that there were different dimensions involved . You're right, this would negate using a user hierarchy.

Using NonEmpty on each attribute should work, maybe there was a bracket out of place. Normally I would use an explicit nested crossjoin() functions or the * operator for crossjoining multiple sets. Maybe start with 2 sets and build up to all 6.

WITH

MEMBER [Date].[DateID].[M1] AS

AGGREGATE({[Date].[DateID].&[20070101]:[Date].[DateID].&[20070103]})

SET [M2] AS

({[dimension7].[attribute7].[value7]})

SELECT {[Measures].[count]} ON COLUMNS,

NON EMPTY {

NONEMPTY([dimension1].[attribute1].Children,[Measures].[count])

* NONEMPTY([dimension2].[attribute2].Children,[Measures].[count])

} ON ROWS

FROM MyCube

WHERE {([Date].[DateID].[M1])}

4294967296 Tuple limit and 32 bit Architecture

We have repeatedly encountered the 4,294,967,296 tuple limit in our MDX queries, when using the Non Empty Operator on a Cross Join of fields:

Example

WITH

MEMBER [Date].[DateID].[M1] AS

AGGREGATE({[Date].[DateID].&[20070101]:[Date].[DateID].&[20070103]})

SET [M2] AS

({[dimension7].[attribute7].[value7]})

SELECT {[Measures].[count]} ON COLUMNS,

NON EMPTY {([dimension1].[attribute1].Children,[dimension2].[attribute2].Children,[M2],[dimesnsion3].[attribute3].Children,[dimension4].[attribute4].Children,[dimension5].[attribute5].Children,[dimension6].[attribute6].Children)} ON ROWS FROM MyCube WHERE {([Date].[DateID].[M1])}

Error

The expression contains a function that cannot operate on a set with more than 4,294,967,296 tuples.

We have followed Microsoft's best practices for Cube Design, while balancing the needs of our application.

Is it a coincidence that the 4,294,967,296 = 2^32 on the order of 4 GigaBytes and our server is of 32-bit architecture?. Will scaling up to a 64-bit architecture machine help? Then will our tuple limit be 2^64 which is on the order of 18 ExaBytes or 18 qunintllion bytes?

This post may help. You may want to follow up on the Analysis Services forum.

|||

Thanks for your reply Teo. I have already refered to this post and unfortunately I'm unable to use the Exists function in this context due to certain limitations in our application.

I have also posted the same issue on the Analysis services forum.

Thanks again for your help.

4294967296 Tuple limit and 32 bit Architecture

We have repeatedly encountered the 4,294,967,296 tuple limit in our MDX queries, when using the Non Empty Operator on a Cross Join of fields:

Example

WITH

MEMBER [Date].[DateID].[M1] AS

AGGREGATE({[Date].[DateID].&[20070101]:[Date].[DateID].&[20070103]})

SET [M2] AS

({[dimension7].[attribute7].[value7]})

SELECT {[Measures].[count]} ON COLUMNS,

NON EMPTY {([dimension1].[attribute1].Children,[dimension2].[attribute2].Children,[M2],[dimesnsion3].[attribute3].Children,[dimension4].[attribute4].Children,[dimension5].[attribute5].Children,[dimension6].[attribute6].Children)} ON ROWS FROM MyCube WHERE {([Date].[DateID].[M1])}

Error

The expression contains a function that cannot operate on a set with more than 4,294,967,296 tuples.

We have followed Microsoft's best practices for Cube Design, while balancing the needs of our application.

Is it a coincidence that the 4,294,967,296 = 2^32 on the order of 4 GigaBytes and our server is of 32-bit architecture?. Will scaling up to a 64-bit architecture machine help? Then will our tuple limit be 2^64 which is on the order of 18 ExaBytes or 18 qunintllion bytes?

Hi prakal,

the 64 bit would be helpfull for you, but I think, that brut force isn't goot approach.

Do you really need to join all 6 dimensions? Why you didn't try to use nonemptycross join.

You would have your query done on the 32bit box as well.

|||

I don't think 64bit will fix this, I believe the 2^32 is more of an SSAS engine limit, not a platform one. The nonemptycrossjoin is depreciated, but you could nonempty() your attribute sets before crossjoining them.

WITH

MEMBER [Date].[DateID].[M1] AS

AGGREGATE({[Date].[DateID].&[20070101]:[Date].[DateID].&[20070103]})

SET [M2] AS

({[dimension7].[attribute7].[value7]})

SELECT {[Measures].[count]} ON COLUMNS,

NON EMPTY {NONEMPTY([dimension1].[attribute1].Children,[Measures].[count]),NONEMPTY([dimension2].[attribute2].Children,[Measures].[count]),NONEMPTY([M2], [Measures].[count]),NONEMPTY([dimesnsion3].[attribute3].Children, [Measures].[count]),NONEMTPY([dimension4].[attribute4].Children, [Measures].[count]),NONEMPTY([dimension5].[attribute5].Children, [Measures].[count]),NONEMPTY([dimension6].[attribute6].Children,[Measures].[count] )} ON ROWS

FROM MyCube

WHERE {([Date].[DateID].[M1])}

Or, if you had all of these attributes as part of a hierarchy you could just do

WITH

MEMBER [Date].[DateID].[M1] AS

AGGREGATE({[Date].[DateID].&[20070101]:[Date].[DateID].&[20070103]})

SET [M2] AS

({[dimension7].[attribute7].[value7]})

SELECT {[Measures].[count]} ON COLUMNS,

NON EMPTY {[dimension1].[hierarchy1].Members} ON ROWS

FROM MyCube

WHERE {([Date].[DateID].[M1])}

|||

A recent thread on this forum linked to a Microsoft Support article that might be relevant:

Error message when you run a complex MDX query that contains the NON EMPTY clause in SQL Server 2005 Analysis Services: "The expression contains a function that cannot operate on a set with more than 4,294,967,296 tuples"

SYMPTOMS

When you use a user account to connect to an instance of Microsoft SQL Server 2005 Analysis Services, you receive the following error message when you run a complex MDX query:

The expression contains a function that cannot operate on a set with more than 4,294,967,296 tuples.

This problem may occur if the following conditions are true:

? The user account is a member of a role that has dimension security set on a measure. ? The complex MDX query contains the NON EMPTY clause.

Back to the top

CAUSE

This issue occurs because the optimized algorithm for the NON EMPTY clause cannot handle dimension security on measures. Therefore, SQL Server 2005 Analysis Services must use the default algorithm for the NON EMPTY clause. If the query is complex, you may receive the error message that the "Symptoms" section mentions.

|||

Darren,

Thanks for your reply. I tried the query in your first solution, but I get the error "Two sets specified in the function have different dimensionality".

Which I guess answers your second solution, all the attributes in the query are a part of different dimensions and cannot be set as a hierarchy of one dimension.

|||

Sorry, I overlooked the detail that there were different dimensions involved . You're right, this would negate using a user hierarchy.

Using NonEmpty on each attribute should work, maybe there was a bracket out of place. Normally I would use an explicit nested crossjoin() functions or the * operator for crossjoining multiple sets. Maybe start with 2 sets and build up to all 6.

WITH

MEMBER [Date].[DateID].[M1] AS

AGGREGATE({[Date].[DateID].&[20070101]:[Date].[DateID].&[20070103]})

SET [M2] AS

({[dimension7].[attribute7].[value7]})

SELECT {[Measures].[count]} ON COLUMNS,

NON EMPTY {

NONEMPTY([dimension1].[attribute1].Children,[Measures].[count])

* NONEMPTY([dimension2].[attribute2].Children,[Measures].[count])

} ON ROWS

FROM MyCube

WHERE {([Date].[DateID].[M1])}

Saturday, February 11, 2012

4 queries into 1 query

I have 4 queries that run fine, giving me the number of different clocking errors for employees. I would like to run just 1 query if possible.

Query 1:
SELECT DISTINCT E.EmpNo, E.FirstName, E.Surname, COUNT(A.CLOCKSEQ) AS LateEarly
from clockwise.Employee E, clockwise.clocking A,
ADMIN.BASIC_DETAILS@.cwselinkptec c, ADMIN.EMP_POST_DETAILS@.cwselinkptec d,ADMIN.POST_DETAILS@.cwselinkptec f
WHERE E.EmpID = A.EmpID AND Trim(E.EmpNo) = Trim(c.EMPLOYEE_NUMBER)
AND A.WorkDate >= to_date('05-01-2005','dd-mm-yyyy') AND A.WorkDate <= to_date('14-01-2005','dd-mm-yyyy')
AND E.Clk_Roster = '!*'
AND c.EMPLOYEE_NUMBER = d.EMPLOYEE_NUMBER
AND d.LINK_EFF_LINK = f.LINK_EFF_LINK AND f.post_location = '5005'
AND (f.POST_EFF_END_DT >= to_date('05-01-2005','dd-mm-yyyy') or f.POST_EFF_END_DT is null)
AND ((A.CLOCKSEQ = 1 AND A.CLOCKIN > 600) OR (A.CLOCKSEQ = 2 AND A.CLOCKOUT < 960))
GROUP BY E.EmpNo, E.FirstName, E.Surname
ORDER BY E.Surname ASC

Gives me: 11111, John, Smith, 3

Query 2:
SELECT DISTINCT E.EmpNo, E.FirstName, E.Surname, COUNT(A.CLOCKSEQ) AS Lunch
from clockwise.Employee E, clockwise.clocking A,
ADMIN.BASIC_DETAILS@.cwselinkptec c, ADMIN.EMP_POST_DETAILS@.cwselinkptec d,ADMIN.POST_DETAILS@.cwselinkptec f
WHERE E.EmpID = A.EmpID AND Trim(E.EmpNo) = Trim(c.EMPLOYEE_NUMBER)
AND A.WorkDate >= to_date('05-01-2005','dd-mm-yyyy') AND A.WorkDate <= to_date('14-01-2005','dd-mm-yyyy')
AND E.Clk_Roster = '!*'
AND c.EMPLOYEE_NUMBER = d.EMPLOYEE_NUMBER
AND d.LINK_EFF_LINK = f.LINK_EFF_LINK AND f.post_location = '5005'
AND (f.POST_EFF_END_DT >= to_date('05-01-2005','dd-mm-yyyy') or f.POST_EFF_END_DT is null)
AND ((A.CLOCKSEQ = 1 AND A.CLOCKOUT < 750) OR (A.CLOCKSEQ = 2 AND A.CLOCKIN > 870))
GROUP BY E.EmpNo, E.FirstName, E.Surname
ORDER BY E.Surname ASC

Gives me: 11111, John, Smith, 1

Query 3:
SELECT DISTINCT E.EmpNo, E.FirstName, E.Surname, COUNT(A.Mins) AS HoursDown
FROM clockwise.Employee E, clockwise.Correcti A,
ADMIN.BASIC_DETAILS@.cwselinkptec c, ADMIN.EMP_POST_DETAILS@.cwselinkptec d, ADMIN.POST_DETAILS@.cwselinkptec f
WHERE E.EmpID = A.EmpID AND Trim(E.EmpNo) = Trim(c.EMPLOYEE_NUMBER)
AND A.WorkDate >= to_date('14-01-2005','dd-mm-yyyy') AND A.WorkDate <= to_date('14-01-2005','dd-mm-yyyy')
AND E.Clk_Roster = '!*'
AND c.EMPLOYEE_NUMBER = d.EMPLOYEE_NUMBER
AND d.LINK_EFF_LINK = f.LINK_EFF_LINK AND f.post_location = '5005'
AND (f.POST_EFF_END_DT >= to_date('14-01-2005','dd-mm-yyyy') or f.POST_EFF_END_DT is null)
AND A.CorrCode = '+[' AND A.Mins < -600
GROUP BY E.EmpNo, E.FirstName, E.Surname
ORDER BY E.Surname ASC

Gives me: 11111, John, Smith, 1

Query 4:
SELECT DISTINCT E.EmpNo, E.FirstName, E.Surname, COUNT(A.CLOCKSEQ) AS ForgotToClock
FROM clockwise.Employee E, clockwise.clocking A,
ADMIN.BASIC_DETAILS@.cwselinkptec c, ADMIN.EMP_POST_DETAILS@.cwselinkptec d, ADMIN.POST_DETAILS@.cwselinkptec f
WHERE E.EmpID = A.EmpID AND Trim(E.EmpNo) = Trim(c.EMPLOYEE_NUMBER)
AND A.WorkDate >= to_date('05-01-2005','dd-mm-yyyy') AND A.WorkDate <= to_date('14-01-2005','dd-mm-yyyy')
AND E.Clk_Roster = '!*'
AND c.EMPLOYEE_NUMBER = d.EMPLOYEE_NUMBER
AND d.LINK_EFF_LINK = f.LINK_EFF_LINK AND f.post_location = '5005'
AND (f.POST_EFF_END_DT >= to_date('05-01-2005','dd-mm-yyyy') or f.POST_EFF_END_DT is null)
AND ((A.CLOCKSEQ = 1
AND A.EmpID NOT IN (SELECT DISTINCT EmpID
FROM clockwise.clocking H
WHERE H.CLOCKSEQ = 2
AND H.WorkDate = A.WorkDate))
OR (A.CLOCKSEQ = 2 AND A.CLOCKOUT = 0)
OR (A.CLOCKSEQ = 1 AND A.CLOCKIN >= 720))
GROUP BY E.EmpNo, E.FirstName, E.Surname
ORDER BY E.Surname ASC

Gives me: 11111, John, Smith, 5

I would like to get 1 row with 11111, John, Smith, 3, 1, 1, 5.

Query 3 select information from the Correcti table, the other 3 queries select information from the Clocking table otherwise the 4 other tables in the queries are the same. The condition that gives the result for each query comes after the AND (f.POST_EFF_END_DT >= to_date('05-01-2005','dd-mm-yyyy') or f.POST_EFF_END_DT is null) line.

Query 1:
AND ((A.CLOCKSEQ = 1 AND A.CLOCKIN > 600) OR (A.CLOCKSEQ = 2 AND A.CLOCKOUT < 960))

Query 2:
AND ((A.CLOCKSEQ = 1 AND A.CLOCKOUT < 750) OR (A.CLOCKSEQ = 2 AND A.CLOCKIN > 870))

Query 3:
AND A.CorrCode = '+[' AND A.Mins < -600

Query 4:
AND ((A.CLOCKSEQ = 1
AND A.EmpID NOT IN (SELECT DISTINCT EmpID
FROM clockwise.clocking H
WHERE H.CLOCKSEQ = 2
AND H.WorkDate = A.WorkDate))
OR (A.CLOCKSEQ = 2 AND A.CLOCKOUT = 0)
OR (A.CLOCKSEQ = 1 AND A.CLOCKIN >= 720))

Thanks for any help with this.
Mark.you might want to look into the UNION operator|||Hi r937,

I've tried union, but I can't seem to get the output I need.

Using union all I can get is 4 records:
11111, John, Smith, 3
11111, John, Smith, 1
11111, John, Smith, 1
11111, John, Smith, 5

instead of 11111, John, Smith, 3, 1, 1, 5.

If only 2 infringements occurr, I'll only get 2 rows and I don't know what these infrigements are for, LateEarly, Lunch, HoursDown or ForgotToClock.

I've also tried just using a union, but adding extra redundant fields to the select statements.
Using the first 2 queries I added an extra field after COUNT(A.CLOCKSEQ) AS LateEarly in the first select and before COUNT(A.CLOCKSEQ) AS Lunch in the second query.
But I get the following:
11111, John, Smith, 3, 3
11111, John, Smith, 1, 1
22222, Joan, Smith, 1, 1

What I need to get is:
11111, John, Smith, 3, 1
22222, Joan, Smith, , 1

any ideas?

Thanks,
Mark.|||Try adding a literal column to the union to indicate LateEarly, Lunch, HoursDown or ForgotToClock and then put the union into a subquery and put a CASE statement on the literal column to put the rows into columns.

4 Queries about DB clustering

Hi, Below are few queries:
1. Say for 2 nodes cluster, Do we need to have 2 copies of Databases( 1 on
each node)
2. Hows does the data Synchronization between different nodes of databases
takes place?
3. In Active/Passive mode, does the passive node database is exactly in the
same state (in terms of data) as that of Active?
4. Is 'Server Cluster' specifically for DB clustering ?
Thanks in advance,
Pankaj A. Chitriv
Answers Inline
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Pankaj" <pankajchitriv@.rediffmail.com(donotspam)> wrote in message
news:847A2BE3-74E1-4B9E-9D61-EEE40D117155@.microsoft.com...
> Hi, Below are few queries:
> 1. Say for 2 nodes cluster, Do we need to have 2 copies of Databases( 1 on
> each node)
No. Data is on shared storage and is controlled by one node at a time.
> 2. Hows does the data Synchronization between different nodes of databases
> takes place?
There is no synchronization. There is a single data store. Access to this
store is arbitrated by the cluster software.
> 3. In Active/Passive mode, does the passive node database is exactly in
the
> same state (in terms of data) as that of Active?
>
Clustering is failover not scaleout technology.

> 4. Is 'Server Cluster' specifically for DB clustering ?
I am not sure what you mean by "Server Cluster"?
> Thanks in advance,
> Pankaj A. Chitriv
>
|||Thanks Geoff.
"Server Cluster" is a inbuild clustering service provided by Windows 2003
Server.
Just wondering, whether that Single Data Store is a seperate windows system?
If so what if that system breaks down? Is that the case that we do DB
clustering only to distribute the processing capabilities?
What I understood by Single Data Store means is there will be a system on
which SQL DB will be created and there would be multiple servers accessing
the same database. But this cannot be called as DB clustering as we don't
have to configure any VIP to access the single data store. Can you clarify
this please?
Thanks a lot again for your answers.
Regards
Pankaj A. Chitriv
"Geoff N. Hiten" wrote:

> Answers Inline
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
> I support the Professional Association for SQL Server
> www.sqlpass.org
> "Pankaj" <pankajchitriv@.rediffmail.com(donotspam)> wrote in message
> news:847A2BE3-74E1-4B9E-9D61-EEE40D117155@.microsoft.com...
> No. Data is on shared storage and is controlled by one node at a time.
> There is no synchronization. There is a single data store. Access to this
> store is arbitrated by the cluster software.
> the
> Clustering is failover not scaleout technology.
> I am not sure what you mean by "Server Cluster"?
>
>
|||Server clustering is available on Windows Server 2003 Enterprise Edition.
"Single Data Store" is not a service, it is a description. All data resides
on a single logical device physically connected to all host nodes. This can
be a SCSI array, a Fiber array, or a SAN. Ownership of this device is
arbitrated by the cluster service. Microsoft SQL DB clustering exists as a
failover technology only and has no distributed computing capabilities. It
is not a scale-out technology. One server owns the entire database and no
other server can access the data without moving the entire SQL instance to
another host. Active-Passive and Active-Active are not accurate
descriptions of the current SQL clustering technology but are somewhat
misleading holdovers from an earlier version.
Again, clustering is for availability and does not allow multiple
simultaneous connections to the data store from different host nodes.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Pankaj" <pankajchitriv@.rediffmail.com(donotspam)> wrote in message
news:4A51BB01-D028-4B3B-9244-12EFA8469987@.microsoft.com...
> Thanks Geoff.
> "Server Cluster" is a inbuild clustering service provided by Windows 2003
> Server.
> Just wondering, whether that Single Data Store is a seperate windows
system?[vbcol=seagreen]
> If so what if that system breaks down? Is that the case that we do DB
> clustering only to distribute the processing capabilities?
> What I understood by Single Data Store means is there will be a system on
> which SQL DB will be created and there would be multiple servers accessing
> the same database. But this cannot be called as DB clustering as we don't
> have to configure any VIP to access the single data store. Can you clarify
> this please?
> Thanks a lot again for your answers.
> Regards
> Pankaj A. Chitriv
> "Geoff N. Hiten" wrote:
Databases( 1 on[vbcol=seagreen]
databases[vbcol=seagreen]
this[vbcol=seagreen]
in[vbcol=seagreen]
|||Hi Geoff.
Thankyou very much for your help. It is just great. I really really
appreciate it.
Further, to summarise our discussion what I understood to implement the SQL
Db Cluster is:
1. I need to have SCSI array, a Fiber array, or a SAN as a shared device
"on which I'll install SQL Server Database".
2. Say in a 2 node cluster, both the nodes would be typically Windows 2k3
Server systems, with the SQL Server Instance reference (SQL Client) to the
shared device on which SQL Server is installed.
3. Say in Active / Passive mode, only 1 Win2k3 system will be utilized and
in case of faliure, the other win2k3 server node will be active.
4. I need to install SQL Client on both the nodes and Sql Server on shared
device.
5. Just wondering whether stored procedures of SQL DB will be executed on
the shared drive or on the Node. Does the shared drive have processing
capabilities?
With this queries clarified , I'm ready to shoot :-).
I really appreciate your help and request your comment on above queries.
Regards,
Pankaj A. Chitriv
"Geoff N. Hiten" wrote:

> Server clustering is available on Windows Server 2003 Enterprise Edition.
> "Single Data Store" is not a service, it is a description. All data resides
> on a single logical device physically connected to all host nodes. This can
> be a SCSI array, a Fiber array, or a SAN. Ownership of this device is
> arbitrated by the cluster service. Microsoft SQL DB clustering exists as a
> failover technology only and has no distributed computing capabilities. It
> is not a scale-out technology. One server owns the entire database and no
> other server can access the data without moving the entire SQL instance to
> another host. Active-Passive and Active-Active are not accurate
> descriptions of the current SQL clustering technology but are somewhat
> misleading holdovers from an earlier version.
> Again, clustering is for availability and does not allow multiple
> simultaneous connections to the data store from different host nodes.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
> I support the Professional Association for SQL Server
> www.sqlpass.org
> "Pankaj" <pankajchitriv@.rediffmail.com(donotspam)> wrote in message
> news:4A51BB01-D028-4B3B-9244-12EFA8469987@.microsoft.com...
> system?
> Databases( 1 on
> databases
> this
> in
>
>
|||You are getting closer. More comments inline.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Pankaj" <pankajchitriv@.rediffmail.com(donotspam)> wrote in message
news:1D8FA145-7AF2-4EBE-9FA1-FD9822233F81@.microsoft.com...
> Hi Geoff.
> Thankyou very much for your help. It is just great. I really really
> appreciate it.
> Further, to summarise our discussion what I understood to implement the
SQL
> Db Cluster is:
> 1. I need to have SCSI array, a Fiber array, or a SAN as a shared device
> "on which I'll install SQL Server Database".
The database(s) will live on the shared storage. SQL binaries will live on
the local disks of each cluster host.
> 2. Say in a 2 node cluster, both the nodes would be typically Windows 2k3
> Server systems, with the SQL Server Instance reference (SQL Client) to the
> shared device on which SQL Server is installed.
A basic two-node SQL cluster will have four systems visible. There are the
two physical host nodes. There is the cluster vrtual server itself. There
is the SQL Server virtual server. Each virtual system must have a minimum
of one unique IP address, one unique network name, and a physical disk
device located on the shared array. You access the SQL server by connecting
to the virtual server by name or IP address.
>

> 3. Say in Active / Passive mode, only 1 Win2k3 system will be utilized and
> in case of faliure, the other win2k3 server node will be active.
>
Correct. The current terms are single-instance and multi-instance. Each
new instance of SQL will have its own disk(s), IP address(es), and Network
name. Once an instance is installed, you can set the preferred host order
to determine the "normal" home host for that instance. You can have up to
16 instances on a single cluster.

> 4. I need to install SQL Client on both the nodes and Sql Server on shared
> device.
>
First you install MSCS (Clustering). Windows 2003 has an excellent
clustering wizard that makes it very difficult to create a non-working
cluster. Then you install a clustered instance of SQL server, running the
install CD from the node that currently owns the disk resource you wish to
use as the first SQL disk. You can assign additional disks after
installation. The installer writes the executable files to each host node
you choose as part of the installation. This includes server and client
components.

> 5. Just wondering whether stored procedures of SQL DB will be executed on
> the shared drive or on the Node. Does the shared drive have processing
> capabilities?
The binaries are on each host node. The memory and CPU resources come from
the host node. The data is stored on the shared array. SQL uses a "Shared
Nothing" model so after installation you can run any instance from any host
node, regardless of whether any other node or instance is running.
[vbcol=seagreen]
> With this queries clarified , I'm ready to shoot :-).
> I really appreciate your help and request your comment on above queries.
> Regards,
> Pankaj A. Chitriv
>
>
> "Geoff N. Hiten" wrote:
Edition.[vbcol=seagreen]
resides[vbcol=seagreen]
can[vbcol=seagreen]
as a[vbcol=seagreen]
It[vbcol=seagreen]
no[vbcol=seagreen]
to[vbcol=seagreen]
2003[vbcol=seagreen]
on[vbcol=seagreen]
accessing[vbcol=seagreen]
don't[vbcol=seagreen]
clarify[vbcol=seagreen]
time.[vbcol=seagreen]
to[vbcol=seagreen]
exactly[vbcol=seagreen]
|||I have a question for Geoff.
I have a similar situation where I plan to install/configure multi-instance
cluster.
My question is
a) as we plan to use/assign drive letters what care shoud be taken for
multi-instance cluster (3 active 1, passive/standby)?
Thanks.
Kamal.
"Geoff N. Hiten" wrote:

> You are getting closer. More comments inline.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
> I support the Professional Association for SQL Server
> www.sqlpass.org
> "Pankaj" <pankajchitriv@.rediffmail.com(donotspam)> wrote in message
> news:1D8FA145-7AF2-4EBE-9FA1-FD9822233F81@.microsoft.com...
> SQL
> The database(s) will live on the shared storage. SQL binaries will live on
> the local disks of each cluster host.
> A basic two-node SQL cluster will have four systems visible. There are the
> two physical host nodes. There is the cluster vrtual server itself. There
> is the SQL Server virtual server. Each virtual system must have a minimum
> of one unique IP address, one unique network name, and a physical disk
> device located on the shared array. You access the SQL server by connecting
> to the virtual server by name or IP address.
> Correct. The current terms are single-instance and multi-instance. Each
> new instance of SQL will have its own disk(s), IP address(es), and Network
> name. Once an instance is installed, you can set the preferred host order
> to determine the "normal" home host for that instance. You can have up to
> 16 instances on a single cluster.
> First you install MSCS (Clustering). Windows 2003 has an excellent
> clustering wizard that makes it very difficult to create a non-working
> cluster. Then you install a clustered instance of SQL server, running the
> install CD from the node that currently owns the disk resource you wish to
> use as the first SQL disk. You can assign additional disks after
> installation. The installer writes the executable files to each host node
> you choose as part of the installation. This includes server and client
> components.
>
> The binaries are on each host node. The memory and CPU resources come from
> the host node. The data is stored on the shared array. SQL uses a "Shared
> Nothing" model so after installation you can run any instance from any host
> node, regardless of whether any other node or instance is running.
> Edition.
> resides
> can
> as a
> It
> no
> to
> 2003
> on
> accessing
> don't
> clarify
> time.
> to
> exactly
>
>
|||All drives will need to be visible to all hosts for failover. Drive letters
are assigned cluster-wide for shared resources. The easiest way is to
pretend you are building a multi-instance stand-alone system where SQL Data
and Logs from multiple instances cannot intersect on the same LUN. Also
remember to add a drive for MSDTC and for the Quorum. Don't forget to leave
room for expansion.
Example
C for local boot, Z for local CD-ROM (Old Novell habit)
Q for Quorum, M for MSDTC
K,L for SQLInstance1 data and logs respectively
R,S for SQLInstance2 data and logs respectively
lather, rinse, repeat.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Kamal Hassan" <KamalHassan@.discussions.microsoft.com> wrote in message
news:5D8375C6-8269-46FC-B619-BD75E0F8A6CD@.microsoft.com...
> I have a question for Geoff.
> I have a similar situation where I plan to install/configure
multi-instance[vbcol=seagreen]
> cluster.
> My question is
> a) as we plan to use/assign drive letters what care shoud be taken for
> multi-instance cluster (3 active 1, passive/standby)?
> Thanks.
> Kamal.
>
>
> "Geoff N. Hiten" wrote:
the[vbcol=seagreen]
device[vbcol=seagreen]
on[vbcol=seagreen]
2k3[vbcol=seagreen]
the[vbcol=seagreen]
the[vbcol=seagreen]
There[vbcol=seagreen]
minimum[vbcol=seagreen]
connecting[vbcol=seagreen]
and[vbcol=seagreen]
Each[vbcol=seagreen]
Network[vbcol=seagreen]
order[vbcol=seagreen]
to[vbcol=seagreen]
shared[vbcol=seagreen]
the[vbcol=seagreen]
to[vbcol=seagreen]
node[vbcol=seagreen]
on[vbcol=seagreen]
processing[vbcol=seagreen]
from[vbcol=seagreen]
"Shared[vbcol=seagreen]
host[vbcol=seagreen]
queries.[vbcol=seagreen]
This[vbcol=seagreen]
is[vbcol=seagreen]
exists[vbcol=seagreen]
capabilities.[vbcol=seagreen]
and[vbcol=seagreen]
instance[vbcol=seagreen]
somewhat[vbcol=seagreen]
nodes.[vbcol=seagreen]
Windows[vbcol=seagreen]
windows[vbcol=seagreen]
DB[vbcol=seagreen]
system[vbcol=seagreen]
we[vbcol=seagreen]
message[vbcol=seagreen]
a[vbcol=seagreen]
of[vbcol=seagreen]
Access[vbcol=seagreen]
|||First, manythanks for quick reply.
In your suggestion is the SQLinstance1 and SQLInstance refer to as ACTIVE
nodes with StandyBy Server or ?
We are not using MSDTC do we still have to setup/configure? and what do you
mean don't forget to leave for expnasion?
Thanks a lot!
Kamal.
"Geoff N. Hiten" wrote:

> All drives will need to be visible to all hosts for failover. Drive letters
> are assigned cluster-wide for shared resources. The easiest way is to
> pretend you are building a multi-instance stand-alone system where SQL Data
> and Logs from multiple instances cannot intersect on the same LUN. Also
> remember to add a drive for MSDTC and for the Quorum. Don't forget to leave
> room for expansion.
> Example
> C for local boot, Z for local CD-ROM (Old Novell habit)
> Q for Quorum, M for MSDTC
> K,L for SQLInstance1 data and logs respectively
> R,S for SQLInstance2 data and logs respectively
> lather, rinse, repeat.
>
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
> I support the Professional Association for SQL Server
> www.sqlpass.org
> "Kamal Hassan" <KamalHassan@.discussions.microsoft.com> wrote in message
> news:5D8375C6-8269-46FC-B619-BD75E0F8A6CD@.microsoft.com...
> multi-instance
> the
> device
> on
> 2k3
> the
> the
> There
> minimum
> connecting
> and
> Each
> Network
> order
> to
> shared
> the
> to
> node
> on
> processing
> from
> "Shared
> host
> queries.
> This
> is
> exists
> capabilities.
> and
> instance
> somewhat
> nodes.
> Windows
> windows
> DB
> system
> we
> message
> a
> of
> Access
>
>
|||Active\Active and Active\Passive are not accurate terms. Each SQL instance
is its own virtual server.
SQLInstance1 and 2 refer to the SQL virtual servers\instances. The host
nodes are all configured identically.
You will have to add disk storage sometime down the road. Leave empty drive
letters for adding new disk resources.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Kamal Hassan" <KamalHassan@.discussions.microsoft.com> wrote in message
news:DD172480-C6FA-41A6-86CC-65A2C790D3C6@.microsoft.com...
> First, manythanks for quick reply.
> In your suggestion is the SQLinstance1 and SQLInstance refer to as ACTIVE
> nodes with StandyBy Server or ?
> We are not using MSDTC do we still have to setup/configure? and what do
you[vbcol=seagreen]
> mean don't forget to leave for expnasion?
> Thanks a lot!
> Kamal.
>
> "Geoff N. Hiten" wrote:
letters[vbcol=seagreen]
Data[vbcol=seagreen]
leave[vbcol=seagreen]
really[vbcol=seagreen]
implement[vbcol=seagreen]
live[vbcol=seagreen]
Windows[vbcol=seagreen]
Client) to[vbcol=seagreen]
are[vbcol=seagreen]
disk[vbcol=seagreen]
utilized[vbcol=seagreen]
up[vbcol=seagreen]
on[vbcol=seagreen]
non-working[vbcol=seagreen]
running[vbcol=seagreen]
wish[vbcol=seagreen]
host[vbcol=seagreen]
client[vbcol=seagreen]
executed[vbcol=seagreen]
come[vbcol=seagreen]
any[vbcol=seagreen]
data[vbcol=seagreen]
nodes.[vbcol=seagreen]
device[vbcol=seagreen]
database[vbcol=seagreen]
multiple[vbcol=seagreen]
message[vbcol=seagreen]
we do[vbcol=seagreen]
a[vbcol=seagreen]
servers[vbcol=seagreen]
as[vbcol=seagreen]
you[vbcol=seagreen]
at[vbcol=seagreen]
nodes[vbcol=seagreen]
is[vbcol=seagreen]

4 million queries, or 4 million rows

Hello!
I need to verify that about 4 million rows were correctly inserted into
the database. Should i do this using one query returning 4 million rows,
or should i query the database 4 million times and returning one row each
query?
The result of the query/queries will be processed in a client application.
Does it matter?
I would prefer the latter, if it can finish in a reasonable amount of time.
Thanks!
Jon
"Jon" <jon@.noreply> wrote in message
news:xn0f10jy5j55qzl00t@.news.microsoft.com...
> Hello!
> I need to verify that about 4 million rows were correctly inserted into
> the database. Should i do this using one query returning 4 million rows,
> or should i query the database 4 million times and returning one row each
> query?
>
Neither. Surely it would make far more sense to write a query that verifies
the result server-side. That way you need only return a Yes/No answer or
some other aggregate or exception result.

> The result of the query/queries will be processed in a client application.
> Does it matter?
> I would prefer the latter, if it can finish in a reasonable amount of
> time.
>
It matters! But if client-side row-by-row processing is an absolute
requirement then you'd better test performance for yourself. I don't know
what you consider reasonable.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
|||Hi Jon
"Jon" wrote:

> Hello!
> I need to verify that about 4 million rows were correctly inserted into
> the database. Should i do this using one query returning 4 million rows,
> or should i query the database 4 million times and returning one row each
> query?
What do you mean by this? If you inserted 4 million rows and no error status
was returned and the transaction was committed then they will be inserted! If
you need to make sure specific values are in a given column then make sure
that you have the correct column/table constraints in place.
>
John
|||The data is not imported from another database, it is file(s) that needs
to be processed before inserting into the database. I need to verify that
the application doing this, does the right thing (which it currently
doesn't). I am not really a pro on T-SQL (can i read from a file using
T-SQL?), so i feel more comfortable doing it in a "normal" application.
I have tried returning all rows in one query, and it takes about 20
minutes to verify the data. The problem is that when elements are missing
from the database, reading the next element from the file and next element
from the database gives a mis-match, because i am simply comparing wrong
items. I can of course "synchronize" this, but i want to keep down the
development time, so if it is just a small time difference, i may just do
it easy for me and not complicate it (the more complicated my code is, the
greater risk of me doing something wrong, which could mean that the
application verifying the insertion has a bug...).
Running time is not critical (it will just be used a few times) and i
would consider about 60 minutes to still be workable to verify the
complete database).
David Portas wrote:

>"Jon" <jon@.noreply> wrote in message
>news:xn0f10jy5j55qzl00t@.news.microsoft.com...
>Neither. Surely it would make far more sense to write a query that
>verifies the result server-side. That way you need only return a Yes/No
>answer or some other aggregate or exception result.
>
>It matters! But if client-side row-by-row processing is an absolute
>requirement then you'd better test performance for yourself. I don't know
>what you consider reasonable.
|||Hi,
The insertion is done by another application, reading text files,
processing each line in the text file, and inserting it into the database.
Unfortunately, it does not log errors, and there can also be a bug in the
application (so i need to verify not only that the element exists, but
also that the data is correct).
Verifying that the data is correct cannot be done using a constraint,
because it can possibly have inserted the data from another element into
the database (for example reading the wrong line in the file).
Jon
John Bell wrote:

>Hi Jon
>"Jon" wrote:
>
>What do you mean by this? If you inserted 4 million rows and no error
>status
>was returned and the transaction was committed then they will be inserted!
>If
>you need to make sure specific values are in a given column then make sure
>that you have the correct column/table constraints in place.
>John
|||Hi Jon
"Jon" wrote:

> Hi,
> The insertion is done by another application, reading text files,
> processing each line in the text file, and inserting it into the database.
> Unfortunately, it does not log errors, and there can also be a bug in the
> application (so i need to verify not only that the element exists, but
> also that the data is correct).
>
Have you considered BCP which will create a file of records that have
errored? Possibly a DTS/SSIS package could process this better?

> Verifying that the data is correct cannot be done using a constraint,
> because it can possibly have inserted the data from another element into
> the database (for example reading the wrong line in the file).
It sounds like you need to improve the program that does the inserts or the
quality of the data!
> --
> Jon
>
John
|||"Jon" <jon@.noreply> wrote in message
news:xn0f10m5sj87sy300v@.news.microsoft.com...
> Hi,
> The insertion is done by another application, reading text files,
> processing each line in the text file, and inserting it into the database.
> Unfortunately, it does not log errors, and there can also be a bug in the
> application (so i need to verify not only that the element exists, but
> also that the data is correct).
> Verifying that the data is correct cannot be done using a constraint,
> because it can possibly have inserted the data from another element into
> the database (for example reading the wrong line in the file).
>
Maybe you could load the file to the server independently and then compare
the two results with a query. Perhaps that seems an odd idea given that you
already have an application doing the same. But if it's possible to bulk
load the file using BCP then I would expect you to see some improvement on
the 20 minute running time you mentioned. Take a look at the BCP topic in
Books Online.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
|||In the first place, I wanted to bulk load the data as-is into the
database, but the db admin said no to this. I was not given any reason for
this. :-(
So I am looking into what other options i have to do this job.
You don't think it is reasonable to query the database a couple of million
times?
David Portas wrote:

>"Jon" <jon@.noreply> wrote in message
>news:xn0f10m5sj87sy300v@.news.microsoft.com...
>Maybe you could load the file to the server independently and then compare
>the two results with a query. Perhaps that seems an odd idea given that
>you already have an application doing the same. But if it's possible to
>bulk load the file using BCP then I would expect you to see some
>improvement on the 20 minute running time you mentioned. Take a look at
>the BCP topic in Books Online.
|||Yes, the program will be improved. But to do this, we need to figure out
what is wrong, hence why i am doing this.
I don't think they are open to loading the data using a complete new
process. I think they want to stick with the original application.

John Bell wrote:

>Hi Jon
>"Jon" wrote:
>Have you considered BCP which will create a file of records that have
>errored? Possibly a DTS/SSIS package could process this better?
>
>It sounds like you need to improve the program that does the inserts or the
>quality of the data!
>John
|||No, it is not on a live system. But the problem still remains, i need to
somehow compare the data from the files with the data that is loaded in
the database, and the question is what is best to do.
John Bell wrote:

>Hi Jon
>
>If that is the case then you will will probably want to take a copy of the
>database and not work on the live system!
>John