Showing posts with label design. Show all posts
Showing posts with label design. Show all posts

Friday, March 23, 2012

Row size limitations of SQL Server 2005

I've created a database design and I'm trying to figure out if it's workable or not. I have 2 tables in particular that are sparse (20 columns, but only a few have data - about 100 bytes/row) but will grow very large - to the tune of 700 million rows.

My question is whether or not there is a problem with SQL Server 2005 having 1.5+ billion rows of data even though it will likely only take up 100 gigs or so on disk. Anyone have experience in large numbers of rows like this? We're still doing testing as far determining how slow queries will get.

Thanks,

Craig

That's fine. SQL Server can deal with that many rows of data. I've worked with tables with billions of rows before. Don't forget to plan for your index space as well and any necessary index maintenance.

-Sue

|||

Try the link below for the SQL Server Max CAP.

http://msdn2.microsoft.com/en-us/library/ms143432.aspx

Tuesday, March 20, 2012

Row level filtering (does not need to be secure)

I'm trying to design a system where I can filter (not secure) a users results, the user may or may not pass in a user ID. We typically use middle tier connection pooling with a single identity, so I believe labelling is not suitable.

I think the ideal solution would be...

    User to establishes a connection through our application, a user id will be established as part of the connection. A view is created describing what the user is able to access. Preferably the user should not be aware of the view. The user or our application executes a number of select queries.

Note that there may be many users with different filters required connecting at any time.

Direct user updates of the table do not need to be supported.

This topic comes up on the forums from time to time in the context of row level security.

The following whitepaper may also be useful to you:

http://www.microsoft.com/technet/prodtechnol/sql/2005/multisec.mspx

It uses labeling but I think your solution will require something like that because you are pushing an id for the user down to SQL Server from the middle tier.

HTH,

-Steven Gott

S/DET

SQL Server

Tuesday, February 21, 2012

Rotational Query?

We're facing a large dilemma. We've rebuilt our entire database in a much
more "normalized" fashion than we had previously (the design was
outrageously bad before). Ultimately, we have the following scenario and
we're getting a huge timeout problem:
Tables:
TblOrder (large, central table, contains all "files", approximately
130,000 records)
OrderFees (joined to TblOrder by FileNumber field, contains FeeType and
Fee)
DateTypes (joined to AppraisalDates by DateType field, contains the
"name" of the Date)
AppraisalDates (joined to TblOrder by FileNumber field, contains
DateType Field and Date)
Right now we're doing a query that returns approximately 5000 records from
TblOrder, then it queries AppraisalDates to get the relevant dates, then it
queries OrderFees, get the relevant fees and then it cycles to the next
record in TblOrder. Big timeout problems.
The only solution I could come up with for this is to create a view that
somehow rotates the relevant records from OrderFees and AppraisalDates and
merges them with TblOrder so that we only have to do one query instead of 3
separate queries. Is this an appropriate solution? I don't know that this
will buy us any "time".
Any suggestions would be appreciated.
Thanks!
JamesPlease post DDL, sample INSERTs and required results so that we don't have
to guess.
http://www.aspfaq.com/etiquette.asp?id=5006
I don't understand why you would "query TblOrder... then query
AppraisalDates...", etc. Don't you just join these tables? You seem to be
describing a cursor.
David Portas
SQL Server MVP
--|||Is there a reason why you can't pull the records from all 4 tables in a
single query with joins?
From your description it looks like:
SELECT columns FROM
tblOrder JOIN OrderFees ON FileNumber...
tblOrder JOIN AppraisalDates ON FileNumber..
AppraisalDates JOIN DateTypes on DateType
The DDL and some INSERT commands for the various tables as well as the
output you would like to see would be helpful. Someone here could then
craft a query for you.
Rick Sawtell
MCT, MCSD, MCDBA
"James" <cppjames@.aol.com> wrote in message
news:%23Srk%23butEHA.3448@.TK2MSFTNGP09.phx.gbl...
> We're facing a large dilemma. We've rebuilt our entire database in a much
> more "normalized" fashion than we had previously (the design was
> outrageously bad before). Ultimately, we have the following scenario and
> we're getting a huge timeout problem:
> Tables:
> TblOrder (large, central table, contains all "files", approximately
> 130,000 records)
> OrderFees (joined to TblOrder by FileNumber field, contains FeeType
and
> Fee)
> DateTypes (joined to AppraisalDates by DateType field, contains the
> "name" of the Date)
> AppraisalDates (joined to TblOrder by FileNumber field, contains
> DateType Field and Date)
> Right now we're doing a query that returns approximately 5000 records from
> TblOrder, then it queries AppraisalDates to get the relevant dates, then
it
> queries OrderFees, get the relevant fees and then it cycles to the next
> record in TblOrder. Big timeout problems.
> The only solution I could come up with for this is to create a view that
> somehow rotates the relevant records from OrderFees and AppraisalDates and
> merges them with TblOrder so that we only have to do one query instead of
3
> separate queries. Is this an appropriate solution? I don't know that
this
> will buy us any "time".
> Any suggestions would be appreciated.
> Thanks!
> James
>|||Did you find an answer for this one? If not, post your queries and DDL and
we can help out.
Thanks,
Michael C., MCDBA
"James" <cppjames@.aol.com> wrote in message
news:%23Srk%23butEHA.3448@.TK2MSFTNGP09.phx.gbl...
> We're facing a large dilemma. We've rebuilt our entire database in a much
> more "normalized" fashion than we had previously (the design was
> outrageously bad before). Ultimately, we have the following scenario and
> we're getting a huge timeout problem:
> Tables:
> TblOrder (large, central table, contains all "files", approximately
> 130,000 records)
> OrderFees (joined to TblOrder by FileNumber field, contains FeeType
and
> Fee)
> DateTypes (joined to AppraisalDates by DateType field, contains the
> "name" of the Date)
> AppraisalDates (joined to TblOrder by FileNumber field, contains
> DateType Field and Date)
> Right now we're doing a query that returns approximately 5000 records from
> TblOrder, then it queries AppraisalDates to get the relevant dates, then
it
> queries OrderFees, get the relevant fees and then it cycles to the next
> record in TblOrder. Big timeout problems.
> The only solution I could come up with for this is to create a view that
> somehow rotates the relevant records from OrderFees and AppraisalDates and
> merges them with TblOrder so that we only have to do one query instead of
3
> separate queries. Is this an appropriate solution? I don't know that
this
> will buy us any "time".
> Any suggestions would be appreciated.
> Thanks!
> James
>

Rotational Query?

We're facing a large dilemma. We've rebuilt our entire database in a much
more "normalized" fashion than we had previously (the design was
outrageously bad before). Ultimately, we have the following scenario and
we're getting a huge timeout problem:
Tables:
TblOrder (large, central table, contains all "files", approximately
130,000 records)
OrderFees (joined to TblOrder by FileNumber field, contains FeeType and
Fee)
DateTypes (joined to AppraisalDates by DateType field, contains the
"name" of the Date)
AppraisalDates (joined to TblOrder by FileNumber field, contains
DateType Field and Date)
Right now we're doing a query that returns approximately 5000 records from
TblOrder, then it queries AppraisalDates to get the relevant dates, then it
queries OrderFees, get the relevant fees and then it cycles to the next
record in TblOrder. Big timeout problems.
The only solution I could come up with for this is to create a view that
somehow rotates the relevant records from OrderFees and AppraisalDates and
merges them with TblOrder so that we only have to do one query instead of 3
separate queries. Is this an appropriate solution? I don't know that this
will buy us any "time".
Any suggestions would be appreciated.
Thanks!
James
Please post DDL, sample INSERTs and required results so that we don't have
to guess.
http://www.aspfaq.com/etiquette.asp?id=5006
I don't understand why you would "query TblOrder... then query
AppraisalDates...", etc. Don't you just join these tables? You seem to be
describing a cursor.
David Portas
SQL Server MVP
|||Is there a reason why you can't pull the records from all 4 tables in a
single query with joins?
From your description it looks like:
SELECT columns FROM
tblOrder JOIN OrderFees ON FileNumber...
tblOrder JOIN AppraisalDates ON FileNumber..
AppraisalDates JOIN DateTypes on DateType
The DDL and some INSERT commands for the various tables as well as the
output you would like to see would be helpful. Someone here could then
craft a query for you.
Rick Sawtell
MCT, MCSD, MCDBA
"James" <cppjames@.aol.com> wrote in message
news:%23Srk%23butEHA.3448@.TK2MSFTNGP09.phx.gbl...
> We're facing a large dilemma. We've rebuilt our entire database in a much
> more "normalized" fashion than we had previously (the design was
> outrageously bad before). Ultimately, we have the following scenario and
> we're getting a huge timeout problem:
> Tables:
> TblOrder (large, central table, contains all "files", approximately
> 130,000 records)
> OrderFees (joined to TblOrder by FileNumber field, contains FeeType
and
> Fee)
> DateTypes (joined to AppraisalDates by DateType field, contains the
> "name" of the Date)
> AppraisalDates (joined to TblOrder by FileNumber field, contains
> DateType Field and Date)
> Right now we're doing a query that returns approximately 5000 records from
> TblOrder, then it queries AppraisalDates to get the relevant dates, then
it
> queries OrderFees, get the relevant fees and then it cycles to the next
> record in TblOrder. Big timeout problems.
> The only solution I could come up with for this is to create a view that
> somehow rotates the relevant records from OrderFees and AppraisalDates and
> merges them with TblOrder so that we only have to do one query instead of
3
> separate queries. Is this an appropriate solution? I don't know that
this
> will buy us any "time".
> Any suggestions would be appreciated.
> Thanks!
> James
>
|||Did you find an answer for this one? If not, post your queries and DDL and
we can help out.
Thanks,
Michael C., MCDBA
"James" <cppjames@.aol.com> wrote in message
news:%23Srk%23butEHA.3448@.TK2MSFTNGP09.phx.gbl...
> We're facing a large dilemma. We've rebuilt our entire database in a much
> more "normalized" fashion than we had previously (the design was
> outrageously bad before). Ultimately, we have the following scenario and
> we're getting a huge timeout problem:
> Tables:
> TblOrder (large, central table, contains all "files", approximately
> 130,000 records)
> OrderFees (joined to TblOrder by FileNumber field, contains FeeType
and
> Fee)
> DateTypes (joined to AppraisalDates by DateType field, contains the
> "name" of the Date)
> AppraisalDates (joined to TblOrder by FileNumber field, contains
> DateType Field and Date)
> Right now we're doing a query that returns approximately 5000 records from
> TblOrder, then it queries AppraisalDates to get the relevant dates, then
it
> queries OrderFees, get the relevant fees and then it cycles to the next
> record in TblOrder. Big timeout problems.
> The only solution I could come up with for this is to create a view that
> somehow rotates the relevant records from OrderFees and AppraisalDates and
> merges them with TblOrder so that we only have to do one query instead of
3
> separate queries. Is this an appropriate solution? I don't know that
this
> will buy us any "time".
> Any suggestions would be appreciated.
> Thanks!
> James
>

Rotational Query?

We're facing a large dilemma. We've rebuilt our entire database in a much
more "normalized" fashion than we had previously (the design was
outrageously bad before). Ultimately, we have the following scenario and
we're getting a huge timeout problem:
Tables:
TblOrder (large, central table, contains all "files", approximately
130,000 records)
OrderFees (joined to TblOrder by FileNumber field, contains FeeType and
Fee)
DateTypes (joined to AppraisalDates by DateType field, contains the
"name" of the Date)
AppraisalDates (joined to TblOrder by FileNumber field, contains
DateType Field and Date)
Right now we're doing a query that returns approximately 5000 records from
TblOrder, then it queries AppraisalDates to get the relevant dates, then it
queries OrderFees, get the relevant fees and then it cycles to the next
record in TblOrder. Big timeout problems.
The only solution I could come up with for this is to create a view that
somehow rotates the relevant records from OrderFees and AppraisalDates and
merges them with TblOrder so that we only have to do one query instead of 3
separate queries. Is this an appropriate solution? I don't know that this
will buy us any "time".
Any suggestions would be appreciated.
Thanks!
JamesPlease post DDL, sample INSERTs and required results so that we don't have
to guess.
http://www.aspfaq.com/etiquette.asp?id=5006
I don't understand why you would "query TblOrder... then query
AppraisalDates...", etc. Don't you just join these tables? You seem to be
describing a cursor.
--
David Portas
SQL Server MVP
--|||Is there a reason why you can't pull the records from all 4 tables in a
single query with joins?
From your description it looks like:
SELECT columns FROM
tblOrder JOIN OrderFees ON FileNumber...
tblOrder JOIN AppraisalDates ON FileNumber..
AppraisalDates JOIN DateTypes on DateType
The DDL and some INSERT commands for the various tables as well as the
output you would like to see would be helpful. Someone here could then
craft a query for you.
Rick Sawtell
MCT, MCSD, MCDBA
"James" <cppjames@.aol.com> wrote in message
news:%23Srk%23butEHA.3448@.TK2MSFTNGP09.phx.gbl...
> We're facing a large dilemma. We've rebuilt our entire database in a much
> more "normalized" fashion than we had previously (the design was
> outrageously bad before). Ultimately, we have the following scenario and
> we're getting a huge timeout problem:
> Tables:
> TblOrder (large, central table, contains all "files", approximately
> 130,000 records)
> OrderFees (joined to TblOrder by FileNumber field, contains FeeType
and
> Fee)
> DateTypes (joined to AppraisalDates by DateType field, contains the
> "name" of the Date)
> AppraisalDates (joined to TblOrder by FileNumber field, contains
> DateType Field and Date)
> Right now we're doing a query that returns approximately 5000 records from
> TblOrder, then it queries AppraisalDates to get the relevant dates, then
it
> queries OrderFees, get the relevant fees and then it cycles to the next
> record in TblOrder. Big timeout problems.
> The only solution I could come up with for this is to create a view that
> somehow rotates the relevant records from OrderFees and AppraisalDates and
> merges them with TblOrder so that we only have to do one query instead of
3
> separate queries. Is this an appropriate solution? I don't know that
this
> will buy us any "time".
> Any suggestions would be appreciated.
> Thanks!
> James
>|||Did you find an answer for this one? If not, post your queries and DDL and
we can help out.
Thanks,
Michael C., MCDBA
"James" <cppjames@.aol.com> wrote in message
news:%23Srk%23butEHA.3448@.TK2MSFTNGP09.phx.gbl...
> We're facing a large dilemma. We've rebuilt our entire database in a much
> more "normalized" fashion than we had previously (the design was
> outrageously bad before). Ultimately, we have the following scenario and
> we're getting a huge timeout problem:
> Tables:
> TblOrder (large, central table, contains all "files", approximately
> 130,000 records)
> OrderFees (joined to TblOrder by FileNumber field, contains FeeType
and
> Fee)
> DateTypes (joined to AppraisalDates by DateType field, contains the
> "name" of the Date)
> AppraisalDates (joined to TblOrder by FileNumber field, contains
> DateType Field and Date)
> Right now we're doing a query that returns approximately 5000 records from
> TblOrder, then it queries AppraisalDates to get the relevant dates, then
it
> queries OrderFees, get the relevant fees and then it cycles to the next
> record in TblOrder. Big timeout problems.
> The only solution I could come up with for this is to create a view that
> somehow rotates the relevant records from OrderFees and AppraisalDates and
> merges them with TblOrder so that we only have to do one query instead of
3
> separate queries. Is this an appropriate solution? I don't know that
this
> will buy us any "time".
> Any suggestions would be appreciated.
> Thanks!
> James
>