Hi, I'm hoping one of you SQL gurus out there will help me with a debate bet
ween myself, a simple Network Admin. and my colleague, an SQL DBA. The W2K/
SQL 2000 box is having performance problems so I was asked to check on it.
Now, in most environments I
have worked in, I took care of the physical server and OS and the DBA/Develo
per types did their own thing. In my current work environment, everyone has
been accustomed to taking care of their own boxes, the DBA included, so the
re are some issues with me
doing my job at all. Anyway, I did a performance analysis of the OS/Hardwar
e and configuration. I also researched the Best Practices for SQL 2000 Serve
r and after a week of collecting metrics, gave the information to the DBA.
There did not appear to be
any disk, memory, paging etc. problems but the one thing that really stood o
ut to me was that the disks were 49% fragmented and the files on those disks
93 and 99% fragmented. Primarily database and log files. Again, I just pr
ovided the info as I do no
t want to step on the DBAs toes. The DBA however, reacted defensively and s
aid that she has *never* defragged an SQL server and in searching through MS
DN, found *no* evidence that there is ever a need to defrag one. Further, t
hat if SQL server could now
find the files in their fragmented state, why was there a problem? If the d
rives were defragged, how would SQL server be able to find the files? She w
as serious. Now, I'm being frowned on as not knowing what I'm talking about.
I'm the newest member of
the team, but not a newbie in the field. I have worked with Microsoft produc
ts now for many years and I know that every Windows box PC or Server needs t
o be defragged and occasionally rebooted as a part of routine maintenace. T
here needs to be a mainten
ance windows for doing so. Having a 99.9% uptime record will not matter when
those drives grind to a halt. What I keep searching for is some reference
from Microsoft or other known expert or publication that will state this as
it pertains to SQL server.
Most of the SQL manuals leave out any OS administration information. Anyone
have any suggestions or comments? Microsoft, are you out there? Please He
lp! TIAmy two cents:
Databases if set up as auto grow and auto shrink, will definitely fragment
disk drives over time. Defragmentation the disks will help improve
performance.
Now, inside a database, there is a page split problem that causes
fragmentation too, It's the DBA's job to reindex tables on a regular basis
to fix index fragmentation. I think you should first get an idea of how the
DBA maintains the index defragmentation, then work on the physical disk
defragmentation. Also there are a lot of other factors affecting database
performance.
Richard
"cdub" <cdub@.newsguy.com> wrote in message
news:29C67933-B2CB-43F3-A498-E8EABD2DB936@.microsoft.com...
> Hi, I'm hoping one of you SQL gurus out there will help me with a debate
between myself, a simple Network Admin. and my colleague, an SQL DBA. The
W2K/SQL 2000 box is having performance problems so I was asked to check on
it. Now, in most environments I have worked in, I took care of the physical
server and OS and the DBA/Developer types did their own thing. In my
current work environment, everyone has been accustomed to taking care of
their own boxes, the DBA included, so there are some issues with me doing my
job at all. Anyway, I did a performance analysis of the OS/Hardware and
configuration. I also researched the Best Practices for SQL 2000 Server and
after a week of collecting metrics, gave the information to the DBA. There
did not appear to be any disk, memory, paging etc. problems but the one
thing that really stood out to me was that the disks were 49% fragmented and
the files on those disks 93 and 99% fragmented. Primarily database and log
files. Again, I just provided the info as I do not want to step on the DBAs
toes. The DBA however, reacted defensively and said that she has *never*
defragged an SQL server and in searching through MSDN, found *no* evidence
that there is ever a need to defrag one. Further, that if SQL server could
now find the files in their fragmented state, why was there a problem? If
the drives were defragged, how would SQL server be able to find the files?
She was serious. Now, I'm being frowned on as not knowing what I'm talking
about. I'm the newest member of the team, but not a newbie in the field. I
have worked with Microsoft products now for many years and I know that every
Windows box PC or Server needs to be defragged and occasionally rebooted as
a part of routine maintenace. There needs to be a maintenance windows for
doing so. Having a 99.9% uptime record will not matter when those drives
grind to a halt. What I keep searching for is some reference from Microsoft
or other known expert or publication that will state this as it pertains to
SQL server. Most of the SQL manuals leave out any OS administration
information. Anyone have any suggestions or comments? Microsoft, are you
out there? Please Help! TIA|||I agree with Richard. I've seen SQL performance affected by fragmentation
and auto-grow. The best way to handle it is usually to plan the size of the
database you need, defrag first, and then allocate the space that you need.
Christian Smith
"Richard Ding" <dingr@.cleanharbors.com> wrote in message
news:uEp2zCo8DHA.2656@.TK2MSFTNGP11.phx.gbl...
> my two cents:
> Databases if set up as auto grow and auto shrink, will definitely fragment
> disk drives over time. Defragmentation the disks will help improve
> performance.
> Now, inside a database, there is a page split problem that causes
> fragmentation too, It's the DBA's job to reindex tables on a regular basis
> to fix index fragmentation. I think you should first get an idea of how
the
> DBA maintains the index defragmentation, then work on the physical disk
> defragmentation. Also there are a lot of other factors affecting database
> performance.
>
> Richard
> "cdub" <cdub@.newsguy.com> wrote in message
> news:29C67933-B2CB-43F3-A498-E8EABD2DB936@.microsoft.com...
> between myself, a simple Network Admin. and my colleague, an SQL DBA. The
> W2K/SQL 2000 box is having performance problems so I was asked to check on
> it. Now, in most environments I have worked in, I took care of the
physical
> server and OS and the DBA/Developer types did their own thing. In my
> current work environment, everyone has been accustomed to taking care of
> their own boxes, the DBA included, so there are some issues with me doing
my
> job at all. Anyway, I did a performance analysis of the OS/Hardware and
> configuration. I also researched the Best Practices for SQL 2000 Server
and
> after a week of collecting metrics, gave the information to the DBA.
There
> did not appear to be any disk, memory, paging etc. problems but the one
> thing that really stood out to me was that the disks were 49% fragmented
and
> the files on those disks 93 and 99% fragmented. Primarily database and
log
> files. Again, I just provided the info as I do not want to step on the
DBAs
> toes. The DBA however, reacted defensively and said that she has *never*
> defragged an SQL server and in searching through MSDN, found *no* evidence
> that there is ever a need to defrag one. Further, that if SQL server
could
> now find the files in their fragmented state, why was there a problem? If
> the drives were defragged, how would SQL server be able to find the files?
> She was serious. Now, I'm being frowned on as not knowing what I'm talking
> about. I'm the newest member of the team, but not a newbie in the field.
I
> have worked with Microsoft products now for many years and I know that
every
> Windows box PC or Server needs to be defragged and occasionally rebooted
as
> a part of routine maintenace. There needs to be a maintenance windows for
> doing so. Having a 99.9% uptime record will not matter when those drives
> grind to a halt. What I keep searching for is some reference from
Microsoft
> or other known expert or publication that will state this as it pertains
to
> SQL server. Most of the SQL manuals leave out any OS administration
> information. Anyone have any suggestions or comments? Microsoft, are you
> out there? Please Help! TIA
>sql
2012年3月25日星期日
2012年3月7日星期三
disagreement over PK "naming convention"
I'm working with a DBA that wants to have the PK for a personnel table be a
uer's network ID. I asked him what happens when the network ID changes, and
(even though there are tables that use it as a FK) he didn't seem to think
it was going to be a problem
Now the way I was raised as a DBA, you just didn't do this - PK's are
usually int identity, and never meaningful names... but what do I know?
Before I disagree more assertively with him, could there be a legitimate
reason, a different line of thought I've missed, regarding database design?
PaulPrimary key names (like table names) must be unique within the database.
Therefore, it makes sense to name the key something like PK_<table name>.
"PJ6" <nobody@.nowhere.net> wrote in message
news:%232WoT3jrFHA.3424@.TK2MSFTNGP14.phx.gbl...
> I'm working with a DBA that wants to have the PK for a personnel table be
> a uer's network ID. I asked him what happens when the network ID changes,
> and (even though there are tables that use it as a FK) he didn't seem to
> think it was going to be a problem
> Now the way I was raised as a DBA, you just didn't do this - PK's are
> usually int identity, and never meaningful names... but what do I know?
> Before I disagree more assertively with him, could there be a legitimate
> reason, a different line of thought I've missed, regarding database
> design?
> Paul
>|||PJ6 wrote:
> I'm working with a DBA that wants to have the PK for a personnel
> table be a uer's network ID. I asked him what happens when the
> network ID changes, and (even though there are tables that use it as
> a FK) he didn't seem to think it was going to be a problem
> Now the way I was raised as a DBA, you just didn't do this - PK's are
> usually int identity, and never meaningful names... but what do I
> know? Before I disagree more assertively with him, could there be a
> legitimate reason, a different line of thought I've missed, regarding
> database design?
>
Oh no! You don't know what you've started!
It's an endless debate without resolution:
http://groups.google.com/groups?q=n...:en&sa=N&tab=wg
Bob Barrows
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.|||"Bob Barrows [MVP]" <reb01501@.NOyahoo.SPAMcom> wrote in message
news:eFucZ7jrFHA.3836@.TK2MSFTNGP12.phx.gbl...
> PJ6 wrote:
> Oh no! You don't know what you've started!
> It's an endless debate without resolution:
> http://groups.google.com/groups?q=n...:en&sa=N&tab=wg
>
But it's fair to say that there is not a consensus that would make your DBA
friend "wrong". I think that everyone would agree that primary keys should
be updated only rarely, and that doing so can be a hastle. However SQL
Server does support ON UPDATE CASCADE foreign key relationships for exactly
this scenario.
If you have a need to track users across changes in their NetworkID then you
have a valid _modeling_ argument to present against using NetworkID as the
PK. I would steer clear of the natural/surrogate key debate, however.
David|||You would expect each personnel's UserID to be unique at any given
moment in time, however, network IDs certainly do change on occasion,
especially if you have a merger between two previously unrelated
corporations or organizations. The keys used to enforce referential
integrity must be consistent and reliable across time, but human derived
coding schemes are frequently not.
I once worked as a contractor for an organization whose email and
network ids were based on first initial / last name. The company acquired a
new executive vice president who was much chagrined that an existing
employee, who had the same first initial/last name, was getting his email
sent from people who didn't bother to lookup the appropriate address. So, he
arm twisted the network admin into re-assinging email IDs to suit his own
personal need, and in the process they totally screwed Exchange server to
the point where the ID had to be deactivated alltogether.
That's the benefit of using a system generated identity value for the
primary key. Let the world plod along as it may, but at least your records
will always be intact.
"PJ6" <nobody@.nowhere.net> wrote in message
news:%232WoT3jrFHA.3424@.TK2MSFTNGP14.phx.gbl...
> I'm working with a DBA that wants to have the PK for a personnel table be
> a uer's network ID. I asked him what happens when the network ID changes,
> and (even though there are tables that use it as a FK) he didn't seem to
> think it was going to be a problem
> Now the way I was raised as a DBA, you just didn't do this - PK's are
> usually int identity, and never meaningful names... but what do I know?
> Before I disagree more assertively with him, could there be a legitimate
> reason, a different line of thought I've missed, regarding database
> design?
> Paul
>|||It′s a religious war :-D
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Bob Barrows [MVP]" wrote:
> PJ6 wrote:
> Oh no! You don't know what you've started!
> It's an endless debate without resolution:
> http://groups.google.com/groups?q=n...:en&sa=N&tab=wg
> Bob Barrows
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>|||Without entering the natural/surrogate keys debate (personally, I stopped
using natural keys and double fields keys many years and since then, more
than half of my problems with databases have disappeared); the use of ON
UPDATE CASCADE foreign key relationships are often useless when your are
dealing with multiple databases on multiple servers or with printed reports.
When you see someone entering your office with a set of reports and bills 6
months old from a (big) client and say that it's now the time to correct
some kind of error(s) and give him his refund, you might be in a big trouble
if you have used natural keys that has changed since then, for exemple
because of a mislabelling or a key-punch error or whatever else.
The use of ON UPDATE CASCADE foreign key relationships is perfect in some
kinds of scenarios - for exemple for storing temporary identity values for
users on the road - but otherwise, it's a disaster waiting to happen.
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:eh%23rRFkrFHA.2604@.TK2MSFTNGP14.phx.gbl...
> "Bob Barrows [MVP]" <reb01501@.NOyahoo.SPAMcom> wrote in message
> news:eFucZ7jrFHA.3836@.TK2MSFTNGP12.phx.gbl...
> But it's fair to say that there is not a consensus that would make your
> DBA friend "wrong". I think that everyone would agree that primary keys
> should be updated only rarely, and that doing so can be a hastle. However
> SQL Server does support ON UPDATE CASCADE foreign key relationships for
> exactly this scenario.
> If you have a need to track users across changes in their NetworkID then
> you have a valid _modeling_ argument to present against using NetworkID as
> the PK. I would steer clear of the natural/surrogate key debate, however.
>
> David
>|||Ignore that. I initially though you were asking about how to name the
primary key.
"JT" <someone@.microsoft.com> wrote in message
news:uaBUH7jrFHA.1168@.TK2MSFTNGP11.phx.gbl...
> Primary key names (like table names) must be unique within the database.
> Therefore, it makes sense to name the key something like PK_<table name>.
> "PJ6" <nobody@.nowhere.net> wrote in message
> news:%232WoT3jrFHA.3424@.TK2MSFTNGP14.phx.gbl...
>|||The DBA you're working with is either (1) a neophyte, (2) a complete moron,
(3) short and doesn't care, (4) a plant from a competitor, (5) trying to
ensure his own job security by building a system that only he can maintain,
or (6) one of Joe Celko's students.
You have my sympathy!
"PJ6" <nobody@.nowhere.net> wrote in message
news:#2WoT3jrFHA.3424@.TK2MSFTNGP14.phx.gbl...
> I'm working with a DBA that wants to have the PK for a personnel table be
a
> uer's network ID. I asked him what happens when the network ID changes,
and
> (even though there are tables that use it as a FK) he didn't seem to think
> it was going to be a problem
> Now the way I was raised as a DBA, you just didn't do this - PK's are
> usually int identity, and never meaningful names... but what do I know?
> Before I disagree more assertively with him, could there be a legitimate
> reason, a different line of thought I've missed, regarding database
design?
> Paul
>|||>> Now the way I was raised as a DBA, you just didn't do this - PK's are usu
ally INTEGER identity, and never meaningful names... but what do I know? <<
No, IDENTITY cannot be a key by definition. A key is a subsert of
attributes whose valeus are unique within an entity. You really need
to read some of Dr. Codd's stuff.
If your company issues a network ID with employment to everyone, this
could work. Set up the proper DRI actions (ON UPDATE CASCADE) and the
SQL engine will handle changes.
Besides uniqueness, yoiu also want to have keys that can be verified
and validated. In this case, they are both easy to test -- just ping
the guy to see if the id matches to the person. This is why so many
e-commerce sites use your email as your log on.
uer's network ID. I asked him what happens when the network ID changes, and
(even though there are tables that use it as a FK) he didn't seem to think
it was going to be a problem
Now the way I was raised as a DBA, you just didn't do this - PK's are
usually int identity, and never meaningful names... but what do I know?
Before I disagree more assertively with him, could there be a legitimate
reason, a different line of thought I've missed, regarding database design?
PaulPrimary key names (like table names) must be unique within the database.
Therefore, it makes sense to name the key something like PK_<table name>.
"PJ6" <nobody@.nowhere.net> wrote in message
news:%232WoT3jrFHA.3424@.TK2MSFTNGP14.phx.gbl...
> I'm working with a DBA that wants to have the PK for a personnel table be
> a uer's network ID. I asked him what happens when the network ID changes,
> and (even though there are tables that use it as a FK) he didn't seem to
> think it was going to be a problem
> Now the way I was raised as a DBA, you just didn't do this - PK's are
> usually int identity, and never meaningful names... but what do I know?
> Before I disagree more assertively with him, could there be a legitimate
> reason, a different line of thought I've missed, regarding database
> design?
> Paul
>|||PJ6 wrote:
> I'm working with a DBA that wants to have the PK for a personnel
> table be a uer's network ID. I asked him what happens when the
> network ID changes, and (even though there are tables that use it as
> a FK) he didn't seem to think it was going to be a problem
> Now the way I was raised as a DBA, you just didn't do this - PK's are
> usually int identity, and never meaningful names... but what do I
> know? Before I disagree more assertively with him, could there be a
> legitimate reason, a different line of thought I've missed, regarding
> database design?
>
Oh no! You don't know what you've started!
It's an endless debate without resolution:
http://groups.google.com/groups?q=n...:en&sa=N&tab=wg
Bob Barrows
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.|||"Bob Barrows [MVP]" <reb01501@.NOyahoo.SPAMcom> wrote in message
news:eFucZ7jrFHA.3836@.TK2MSFTNGP12.phx.gbl...
> PJ6 wrote:
> Oh no! You don't know what you've started!
> It's an endless debate without resolution:
> http://groups.google.com/groups?q=n...:en&sa=N&tab=wg
>
But it's fair to say that there is not a consensus that would make your DBA
friend "wrong". I think that everyone would agree that primary keys should
be updated only rarely, and that doing so can be a hastle. However SQL
Server does support ON UPDATE CASCADE foreign key relationships for exactly
this scenario.
If you have a need to track users across changes in their NetworkID then you
have a valid _modeling_ argument to present against using NetworkID as the
PK. I would steer clear of the natural/surrogate key debate, however.
David|||You would expect each personnel's UserID to be unique at any given
moment in time, however, network IDs certainly do change on occasion,
especially if you have a merger between two previously unrelated
corporations or organizations. The keys used to enforce referential
integrity must be consistent and reliable across time, but human derived
coding schemes are frequently not.
I once worked as a contractor for an organization whose email and
network ids were based on first initial / last name. The company acquired a
new executive vice president who was much chagrined that an existing
employee, who had the same first initial/last name, was getting his email
sent from people who didn't bother to lookup the appropriate address. So, he
arm twisted the network admin into re-assinging email IDs to suit his own
personal need, and in the process they totally screwed Exchange server to
the point where the ID had to be deactivated alltogether.
That's the benefit of using a system generated identity value for the
primary key. Let the world plod along as it may, but at least your records
will always be intact.
"PJ6" <nobody@.nowhere.net> wrote in message
news:%232WoT3jrFHA.3424@.TK2MSFTNGP14.phx.gbl...
> I'm working with a DBA that wants to have the PK for a personnel table be
> a uer's network ID. I asked him what happens when the network ID changes,
> and (even though there are tables that use it as a FK) he didn't seem to
> think it was going to be a problem
> Now the way I was raised as a DBA, you just didn't do this - PK's are
> usually int identity, and never meaningful names... but what do I know?
> Before I disagree more assertively with him, could there be a legitimate
> reason, a different line of thought I've missed, regarding database
> design?
> Paul
>|||It′s a religious war :-D
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Bob Barrows [MVP]" wrote:
> PJ6 wrote:
> Oh no! You don't know what you've started!
> It's an endless debate without resolution:
> http://groups.google.com/groups?q=n...:en&sa=N&tab=wg
> Bob Barrows
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>|||Without entering the natural/surrogate keys debate (personally, I stopped
using natural keys and double fields keys many years and since then, more
than half of my problems with databases have disappeared); the use of ON
UPDATE CASCADE foreign key relationships are often useless when your are
dealing with multiple databases on multiple servers or with printed reports.
When you see someone entering your office with a set of reports and bills 6
months old from a (big) client and say that it's now the time to correct
some kind of error(s) and give him his refund, you might be in a big trouble
if you have used natural keys that has changed since then, for exemple
because of a mislabelling or a key-punch error or whatever else.
The use of ON UPDATE CASCADE foreign key relationships is perfect in some
kinds of scenarios - for exemple for storing temporary identity values for
users on the road - but otherwise, it's a disaster waiting to happen.
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:eh%23rRFkrFHA.2604@.TK2MSFTNGP14.phx.gbl...
> "Bob Barrows [MVP]" <reb01501@.NOyahoo.SPAMcom> wrote in message
> news:eFucZ7jrFHA.3836@.TK2MSFTNGP12.phx.gbl...
> But it's fair to say that there is not a consensus that would make your
> DBA friend "wrong". I think that everyone would agree that primary keys
> should be updated only rarely, and that doing so can be a hastle. However
> SQL Server does support ON UPDATE CASCADE foreign key relationships for
> exactly this scenario.
> If you have a need to track users across changes in their NetworkID then
> you have a valid _modeling_ argument to present against using NetworkID as
> the PK. I would steer clear of the natural/surrogate key debate, however.
>
> David
>|||Ignore that. I initially though you were asking about how to name the
primary key.
"JT" <someone@.microsoft.com> wrote in message
news:uaBUH7jrFHA.1168@.TK2MSFTNGP11.phx.gbl...
> Primary key names (like table names) must be unique within the database.
> Therefore, it makes sense to name the key something like PK_<table name>.
> "PJ6" <nobody@.nowhere.net> wrote in message
> news:%232WoT3jrFHA.3424@.TK2MSFTNGP14.phx.gbl...
>|||The DBA you're working with is either (1) a neophyte, (2) a complete moron,
(3) short and doesn't care, (4) a plant from a competitor, (5) trying to
ensure his own job security by building a system that only he can maintain,
or (6) one of Joe Celko's students.
You have my sympathy!
"PJ6" <nobody@.nowhere.net> wrote in message
news:#2WoT3jrFHA.3424@.TK2MSFTNGP14.phx.gbl...
> I'm working with a DBA that wants to have the PK for a personnel table be
a
> uer's network ID. I asked him what happens when the network ID changes,
and
> (even though there are tables that use it as a FK) he didn't seem to think
> it was going to be a problem
> Now the way I was raised as a DBA, you just didn't do this - PK's are
> usually int identity, and never meaningful names... but what do I know?
> Before I disagree more assertively with him, could there be a legitimate
> reason, a different line of thought I've missed, regarding database
design?
> Paul
>|||>> Now the way I was raised as a DBA, you just didn't do this - PK's are usu
ally INTEGER identity, and never meaningful names... but what do I know? <<
No, IDENTITY cannot be a key by definition. A key is a subsert of
attributes whose valeus are unique within an entity. You really need
to read some of Dr. Codd's stuff.
If your company issues a network ID with employment to everyone, this
could work. Set up the proper DRI actions (ON UPDATE CASCADE) and the
SQL engine will handle changes.
Besides uniqueness, yoiu also want to have keys that can be verified
and validated. In this case, they are both easy to test -- just ping
the guy to see if the id matches to the person. This is why so many
e-commerce sites use your email as your log on.
订阅:
博文 (Atom)