May 12, 2003 at 11:48 am
Newbie Question:
Just wandering, should lookup tables with primary key columns defined as byte be indexed? Most of my lookup tables only have about between 3-25 items.
Thanks.
--Lenard
May 12, 2003 at 2:17 pm
What is the record size? Will all data fit on one SQL page?
May 12, 2003 at 2:36 pm
You should still consider a Clustered index even on a small table. It will add very minimal overhead to storage (statistics stuff which you generally see created anyway, table will still be in same space just sorted).
May 12, 2003 at 2:41 pm
Agreed, contradicted myself. If one do a proper db design it should not be an issue, secondly index can only help optimizer!
May 12, 2003 at 6:49 pm
Great, that is what I was doing....just wanted to make sure I was on the right track.
Thanks guys.
--Lenard
May 28, 2003 at 2:36 pm
What is a datatype of BYTE? Did you mean a BIT datatype, or something like a CHAR(1)?
I disagree with having indexes on all tables and can create a situation where the index will hurt the optimizer even with current statistics. Indexes are overhead, no unique clustered indexes also have to store a unique identifier, which is more overhead. If the table is small enough then let SQL Server pull the table into memory. Also, you have to consider the overhead to transactions (update, delete, and inserts). Lot's to think about when creating an index!! Of course, this is just one persons opinion..from someone who doesn't like EM creating a clustered index..I think that needs to be a decision, not a default.
If you are talking about a BIT datatype..Good question!! Since SQL Server does not allow indexes to be built on BIT datatypes (probably because the selectivity will be poor). I am going to test this out; create a composite primary key with one of the attributes being of type BIT.
"Keep Your Stick On the Ice" ..Red Green
May 28, 2003 at 2:40 pm
Good rule of thumb..
Tuning is all about I/O
"Keep Your Stick On the Ice" ..Red Green
May 28, 2003 at 6:48 pm
I was referring to a "TinyInt" as a "byte".
May 29, 2003 at 3:35 am
quote:
What is a datatype of BYTE? Did you mean a BIT datatype, or something like a CHAR(1)?I disagree with having indexes on all tables and can create a situation where the index will hurt the optimizer even with current statistics. Indexes are overhead, no unique clustered indexes also have to store a unique identifier, which is more overhead. If the table is small enough then let SQL Server pull the table into memory. Also, you have to consider the overhead to transactions (update, delete, and inserts). Lot's to think about when creating an index!! Of course, this is just one persons opinion..from someone who doesn't like EM creating a clustered index..I think that needs to be a decision, not a default.
If you are talking about a BIT datatype..Good question!! Since SQL Server does not allow indexes to be built on BIT datatypes (probably because the selectivity will be poor). I am going to test this out; create a composite primary key with one of the attributes being of type BIT.
As stated he was referring to TINYINT which supports 256 possible values (0-255 no negatives). A bit will either be 1 or 0 which menas it is a 50/50 chance so table scanning is as efficient do to the low selectivity of the situation and would never make a good index. Similarly if you have a relatively low number of unique values for a column it generally will not make a good index.
May 29, 2003 at 11:34 am
just a quick note on bit data type, you can index on it, although it does not make sense to do so. weird thing is in enterprise manager to index on it, you can not do it in design mode, you must insted right click on the table name go to all tasks, manage indexes, then you can select bit field.
June 14, 2003 at 8:17 pm
What is the point in an index on a bit data type column. btw i have a background in c/c++ and thought that B-Tree meant Binary Tree. Now MS are telling me that it means Balance Tree. Has this always been the case?
June 16, 2003 at 8:27 am
Balance Tree? What the heck is that? I know what a B-tree is and a B* tree, but....
....biting my toungue!!
"Keep Your Stick On the Ice" ..Red Green
June 17, 2003 at 1:05 am
Hi jeffwe,
quote:
Balance Tree? What the heck is that? I know what a B-tree is and a B* tree, but........biting my toungue!!
Definition: A tree where no leaf is much farther away from the root than any other leaf. Different balancing schemes allow different definitions of "much farther" and different amounts of work to keep them balanced.
Cheers,
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply