dbTalk Databases Forums  

CREATE DATABASE good practice

microsoft.public.sqlserver.setup microsoft.public.sqlserver.setup


Discuss CREATE DATABASE good practice in the microsoft.public.sqlserver.setup forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
syd_p
 
Posts: n/a

Default CREATE DATABASE good practice - 01-22-2010 , 04:14 PM






Can someone help me to optimise this create db?
CREATE DATABASE EVSTORE ON PRIMARY
(
NAME=evstore_data,
FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.mdf',
SIZE = 10 MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000 KB
)
LOG ON
(
NAME=evstore_log,
FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.ldf',
SIZE = 10 MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000 KB
)
I googled this to put the database on the E: drive which is a SAN.
This db will grow and have lots if rows increasing every day, so I
want to avoid bad practice, and have fast queries event when it has
got big after a year.

And suggestions to make this better, please?

Syd

Reply With Quote
  #2  
Old   
Tom Moreau
 
Posts: n/a

Default Re: CREATE DATABASE good practice - 01-22-2010 , 04:19 PM






You need to do some capacity planning. Figure out how much growth your DB
will go through during the lifetime of the machine and allocate that plus
some contingency. This way, you avoid disk fragmentation.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"syd_p" <sydneypuente (AT) yahoo (DOT) com> wrote

Can someone help me to optimise this create db?
CREATE DATABASE EVSTORE ON PRIMARY
(
NAME=evstore_data,
FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.mdf',
SIZE = 10 MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000 KB
)
LOG ON
(
NAME=evstore_log,
FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.ldf',
SIZE = 10 MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000 KB
)
I googled this to put the database on the E: drive which is a SAN.
This db will grow and have lots if rows increasing every day, so I
want to avoid bad practice, and have fast queries event when it has
got big after a year.

And suggestions to make this better, please?

Syd

Reply With Quote
  #3  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: CREATE DATABASE good practice - 01-22-2010 , 04:41 PM



syd_p (sydneypuente (AT) yahoo (DOT) com) writes:
Quote:
Can someone help me to optimise this create db?
CREATE DATABASE EVSTORE ON PRIMARY
(
NAME=evstore_data,
FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.mdf',
SIZE = 10 MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000 KB
)
LOG ON
(
NAME=evstore_log,
FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.ldf',
SIZE = 10 MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000 KB
)
I googled this to put the database on the E: drive which is a SAN.
This db will grow and have lots if rows increasing every day, so I
want to avoid bad practice, and have fast queries event when it has
got big after a year.
To achieve that, you will need to get more things right than just the
CREATE DATABASE statement. But at least it's a start. But 10 MB is not
a good start, if you execpted it to grow. If you exepct it to be 10 GB
in a year, create it as 10 GB now. As Tom said, you need some capacity
planning.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #4  
Old   
syd_p
 
Posts: n/a

Default Re: CREATE DATABASE good practice - 01-23-2010 , 04:04 PM



On 22 Jan, 22:41, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:
Quote:
syd_p (sydneypue... (AT) yahoo (DOT) com) writes:
Can someone help me to optimise this create db?
* * *CREATE DATABASE EVSTORE ON PRIMARY
* * *(
* * * *NAME=evstore_data,
* * * *FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.mdf',
* * * SIZE = 10 MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000KB
* * * *)
* * *LOG ON
* * * *(
* * * *NAME=evstore_log,
* * * *FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.ldf',
* * *SIZE = 10 MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000 KB
* * * *)
I *googled this to *put the database on the E: drive which is a SAN..
This db will grow and have lots if rows increasing every day, so I
want to avoid bad practice, and have fast queries event when it has
got big after a year.

To achieve that, you will need to get more things right than just the
CREATE DATABASE statement. But at least it's a start. But 10 MB is not
a good start, if you execpted it to grow. If you exepct it to be 10 GB
in a year, create it as 10 GB now. As Tom said, you need some capacity
planning.

--
Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000:http://www.microsoft.com/sql/prodinf...ons/books.mspx
Can someone help me to optimise this create db?
CREATE DATABASE EVSTORE ON PRIMARY
(
NAME=evstore_data,
FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.mdf',
SIZE = 10 GB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000 KB
)
LOG ON
(
NAME=evstore_log,
FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.ldf',
SIZE = 10 GB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000 KB
)
Good point - I reckon it might be 10 GB in a 6 months/year
How does it look now?

Reply With Quote
  #5  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: CREATE DATABASE good practice - 01-24-2010 , 08:58 AM



syd_p (sydneypuente (AT) yahoo (DOT) com) writes:
Quote:
Can someone help me to optimise this create db?
CREATE DATABASE EVSTORE ON PRIMARY
(
NAME=evstore_data,
FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.mdf',
SIZE = 10 GB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000 KB
)
LOG ON
(
NAME=evstore_log,
FILENAME='E:\Program Files\Microsoft SQL Server\MSSQL\Data
\db1.ldf',
SIZE = 10 GB, MAXSIZE = UNLIMITED, FILEGROWTH = 20000 KB
)
Good point - I reckon it might be 10 GB in a 6 months/year
How does it look now?
I'm afraid that your question is not very meaningful. Getting good
performance is more than getting the CREATE DATABASE statemetn right.

Here you have set the autogrow to 20 MB, which is not very much. This
means that when the database starts to grow, it will grow in small
pieces, which leads to fragmentation on disk.

Then again, if you set autogrow to 1 GB, an autogrow can cause a
noticeable stall when it happens. In such case 20 MB may be a better
choice.

The true answer is that autogrow should never occur, but the database
should be grown under planned circumstances in a maintenance window.
But since I don't know anything how you plan to monitor this database,
I cannot really give any advice.

You have also put both data and log on the same disk. This is certainly
not a good idea at all, but they should be on different disks, and on
different LUNs in the SAN.

Then again, I know nothing what you will use this database for, and
without any information about the context all advices could very well
be misguided.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #6  
Old   
syd_p
 
Posts: n/a

Default Re: CREATE DATABASE good practice - 01-26-2010 , 07:16 AM



Quote:
You have also put both data and log on the same disk. This is certainly
not a good idea at all, but they should be on different disks, and on
different LUNs in the SAN.

Then again, I know nothing what you will use this database for, and
without any information about the context all advices could very well
be misguided.

--
Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000:http://www.microsoft.com/sql/prodinf...ons/books.mspx
I reckon the advice above is real good - Thanks.
I was wondering how big the log file might get - I have made it the
same size as db file.

Reply With Quote
  #7  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: CREATE DATABASE good practice - 01-26-2010 , 04:51 PM



syd_p (sydneypuente (AT) yahoo (DOT) com) writes:
Quote:
I was wondering how big the log file might get - I have made it the
same size as db file.
That's very difficult to tell with knowledge about what the system does.
But if you never back up your transaction log, the log will become very
big!



--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.