Storage

  • Hello to all.

    I've keep telling my colleagues that especially for tables that going to hold large amount of rows they should be careful on storing only what they need.

    For example. A table that is going to hold the customer phone numbers has a column called PhoneType. This table will have million of rows. They create the column as VarChar(20) ('Home', 'Work', 'Mobile') these values are fixed and will never change. This table will have hundreds every hour, lots of reads

    In my opinion it should be a char(1) or a foreign key to another table. I think that like this will reduce the size of each record, so less reads, more memory, smaller data base, etc.

    But i do not how to present evidence of this. Could please any give a some directions on this particular matter?

  • Hi,

    You can show a lab with the total size used by a table with or without space optimization. Use sys catalogue to get the size of both tables. You can get a sample query just googling "Get size of all tables in database".

  • If it were my database, I'd have char(1) with a check constraint so that only values of H, W and M are allowed. The meanings of those values would be set out in the database documentation.

    John

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply