Showing posts with label showing. Show all posts
Showing posts with label showing. Show all posts

Monday, March 19, 2012

Indexing etiquette

I'm using Idera's SQL Diagnostic Manager and its showing me my index is
using the File Group "Primary" (which I recently read is bad) and I
have 3 index levels with some Data values having in excess of 700K
rows.
Is this bad and should I be worried? Is there some housekeeping I
should do in these situations?
TIA
Robrcamarda (rcamarda@.cablespeed.com) writes:
> I'm using Idera's SQL Diagnostic Manager and its showing me my index is
> using the File Group "Primary" (which I recently read is bad)

There are situations where you can split up databases on several
file groups, and for instance have non-clustered index on a separate
volume. Note that if you relocate the clustered index, you relocate
the data as well.

But this should only be done if you have a clear understand of what you
win. None of our customer's databases have more than the two files
each database is born with. (And thus only one file group.)

> and I have 3 index levels with some Data values having in excess of 700K
> rows.
> Is this bad and should I be worried? Is there some housekeeping I
> should do in these situations?

It's a good idea to run DBCC DBREINDEX on your tables, if they tend
to fragment. Whether they fragment, can be concluded by using
DBCC SHOWCONTIG.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||In books online there is an example which checks for fragmentation
above a level of 30% and runs the reindex function. Is this a good
number ot use or is it one of those "depends" kind of things?|||pb648174 (google@.webpaul.net) writes:
> In books online there is an example which checks for fragmentation
> above a level of 30% and runs the reindex function. Is this a good
> number ot use or is it one of those "depends" kind of things?

It's not a bad number. We ship our maintenance job that uses the output
from DBCC SHOWCONTIG, and if a table is fragmented enough, we run DBCC
DBREINDEX. And the bar where we reindex is, as far as I recall, precisely
30%...

What we have adding recently, and me and our admin-kind-of-guy has not
really arrived on the best strategy for, is to run UPDATE STASTISTICS
WITH FULLSCAN on table we don't reindex. Table that don't get defragmented
despite heavy insertion traffic, probably has a monotonic clustered
index, so statistics will be inaccurate after a while.

Then as always there are cases where you may want to deviate. For instance,
clustered index an guids is often said to be recipe for quick fragmentation.
However, SQL Server MVP Greg Linwood pointed out to me, that this can
be used to your advantage. You define the index with a relatively low
fill factor, say 50%. What will happen now is that insertion will happen
all over the place, but page splits will be rare, since all pages have
room to spare. So with design, framgmenation actually decreases as time
goes. Up to a certain point that is, once you are starting to fill up
more and more pages, page split will rage here and there. The idea is
that you monitor the state of the database closely, and that you have a
maintenance window where you again can reindex to 50%.

It goes without saying that this strategy is nothing for the left-hand
DBA, but requires thorough understanding and most of all, daily
monitoring of the state of the database.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Do you have an example of that maintenance job somewhere? We don't look
at the database daily and have many installations so it needs to be
scripted and run on its own without any supervision or intervention.

I'm right handed and not a DBA...

Wednesday, March 7, 2012

Indexes in Enterprise Manager under "Table Info" tab

Does anyone knows what kind of indexes are the ones showing up under certain
tables in the "Table Info" tab? The indexes in question start with "_WA".
Also, I would like to know when they get created? and when are they being
used?It is my understanding that _wa objects are system created statistics.
--
Thomas
"Sal Young" wrote:
> Does anyone knows what kind of indexes are the ones showing up under certain
> tables in the "Table Info" tab? The indexes in question start with "_WA".
> Also, I would like to know when they get created? and when are they being
> used?|||Sal,
They're auto statistics entries. Take a look at the space usage columns and
you'll see the value 0.
HTH
Jerry
"Sal Young" <SalYoung@.discussions.microsoft.com> wrote in message
news:AB3E0B0C-8CD8-4257-AEF8-FE25C63122F2@.microsoft.com...
> Does anyone knows what kind of indexes are the ones showing up under
> certain
> tables in the "Table Info" tab? The indexes in question start with "_WA".
> Also, I would like to know when they get created? and when are they being
> used?

Indexes in Enterprise Manager under "Table Info" tab

Does anyone knows what kind of indexes are the ones showing up under certain
tables in the "Table Info" tab? The indexes in question start with "_WA".
Also, I would like to know when they get created? and when are they being
used?It is my understanding that _wa objects are system created statistics.
--
Thomas
"Sal Young" wrote:

> Does anyone knows what kind of indexes are the ones showing up under certa
in
> tables in the "Table Info" tab? The indexes in question start with "_WA".
> Also, I would like to know when they get created? and when are they being
> used?|||Sal,
They're auto statistics entries. Take a look at the space usage columns and
you'll see the value 0.
HTH
Jerry
"Sal Young" <SalYoung@.discussions.microsoft.com> wrote in message
news:AB3E0B0C-8CD8-4257-AEF8-FE25C63122F2@.microsoft.com...
> Does anyone knows what kind of indexes are the ones showing up under
> certain
> tables in the "Table Info" tab? The indexes in question start with "_WA".
> Also, I would like to know when they get created? and when are they being
> used?

Indexes in Enterprise Manager under "Table Info" tab

Does anyone knows what kind of indexes are the ones showing up under certain
tables in the "Table Info" tab? The indexes in question start with "_WA".
Also, I would like to know when they get created? and when are they being
used?
It is my understanding that _wa objects are system created statistics.
Thomas
"Sal Young" wrote:

> Does anyone knows what kind of indexes are the ones showing up under certain
> tables in the "Table Info" tab? The indexes in question start with "_WA".
> Also, I would like to know when they get created? and when are they being
> used?
|||Sal,
They're auto statistics entries. Take a look at the space usage columns and
you'll see the value 0.
HTH
Jerry
"Sal Young" <SalYoung@.discussions.microsoft.com> wrote in message
news:AB3E0B0C-8CD8-4257-AEF8-FE25C63122F2@.microsoft.com...
> Does anyone knows what kind of indexes are the ones showing up under
> certain
> tables in the "Table Info" tab? The indexes in question start with "_WA".
> Also, I would like to know when they get created? and when are they being
> used?

Friday, February 24, 2012

Indexes :-

hi,
one small ques on indexes, i added one composite index on table to avoud clus index scan(cost 70%) , when i checked executioin plan it is showing me like clus index seek using the above defined index + bookmark lookup operator also..
so which soln should i go for clus index scan or bookmark operator using clus index seek (for composit index0
--
SanjuRun the query both ways in Query Analyzer and look at the Total Plan cost
... use whichever is cheaper..
I suspect if you are returning more than (maybe) 5% of the rows in the table
the clustered index scan might be cheaper...
However it does depend on the percentage of the rows returned, a single or
very small number of rows returned will likely be best served by the
nonclust and bookmark lookup, a larger percentage of rows and the clustered
index scan will be faster...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Sanjay" <Sanjay@.discussions.microsoft.com> wrote in message
news:B0F41810-3BC3-4D2C-9996-7D08C46F614D@.microsoft.com...
> hi,
> one small ques on indexes, i added one composite index on table to avoud
clus index scan(cost 70%) , when i checked executioin plan it is showing me
like clus index seek using the above defined index + bookmark lookup
operator also..
> so which soln should i go for clus index scan or bookmark operator using
clus index seek (for composit index0
> --
> Sanju

Indexes :-

hi,
one small ques on indexes, i added one composite index on table to avoud clu
s index scan(cost 70%) , when i checked executioin plan it is showing me lik
e clus index seek using the above defined index + bookmark lookup operator a
lso..
so which soln should i go for clus index scan or bookmark operator using clu
s index seek (for composit index0
SanjuRun the query both ways in Query Analyzer and look at the Total Plan cost
... use whichever is cheaper..
I suspect if you are returning more than (maybe) 5% of the rows in the table
the clustered index scan might be cheaper...
However it does depend on the percentage of the rows returned, a single or
very small number of rows returned will likely be best served by the
nonclust and bookmark lookup, a larger percentage of rows and the clustered
index scan will be faster...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Sanjay" <Sanjay@.discussions.microsoft.com> wrote in message
news:B0F41810-3BC3-4D2C-9996-7D08C46F614D@.microsoft.com...
> hi,
> one small ques on indexes, i added one composite index on table to avoud
clus index scan(cost 70%) , when i checked executioin plan it is showing me
like clus index seek using the above defined index + bookmark lookup
operator also..
> so which soln should i go for clus index scan or bookmark operator using
clus index seek (for composit index0
> --
> Sanju

Indexes :-

hi,
one small ques on indexes, i added one composite index on table to avoud clus index scan(cost 70%) , when i checked executioin plan it is showing me like clus index seek using the above defined index + bookmark lookup operator also..
so which soln should i go for clus index scan or bookmark operator using clus index seek (for composit index0
Sanju
Run the query both ways in Query Analyzer and look at the Total Plan cost
.... use whichever is cheaper..
I suspect if you are returning more than (maybe) 5% of the rows in the table
the clustered index scan might be cheaper...
However it does depend on the percentage of the rows returned, a single or
very small number of rows returned will likely be best served by the
nonclust and bookmark lookup, a larger percentage of rows and the clustered
index scan will be faster...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Sanjay" <Sanjay@.discussions.microsoft.com> wrote in message
news:B0F41810-3BC3-4D2C-9996-7D08C46F614D@.microsoft.com...
> hi,
> one small ques on indexes, i added one composite index on table to avoud
clus index scan(cost 70%) , when i checked executioin plan it is showing me
like clus index seek using the above defined index + bookmark lookup
operator also..
> so which soln should i go for clus index scan or bookmark operator using
clus index seek (for composit index0
> --
> Sanju