Subject | what is better: Index on single column or index on multi column ? |
---|---|
Author | Vander Clock Stephane |
Post date | 2010-12-21T21:46:27Z |
hello,
what is better (with around 30 000 000 rows) :
Create table TABLEA
SERVER SMALLINT NOT NULL,
volume SMALLINT NOT NULL,
ID INTEGER NOT NULL,
Key BIGINT NOT NULL
Create index multicolumnindex on TABLEA(SERVER, Volume, ID, Key);
or
Create table TABLEA
SERVER_VOLUME_ID_KEY VARCHAR(40) //will be something like
32-123-432-1287634-324938347437347347879
Create index onecolumnindex on TABLEA(SERVER_VOLUME_ID_KEY);
in the first variant i use only 16bytes and in the second 40 bytes..
but the data stored is the same and it's change nothing for our application
what is better (with around 30 000 000 rows) :
Create table TABLEA
SERVER SMALLINT NOT NULL,
volume SMALLINT NOT NULL,
ID INTEGER NOT NULL,
Key BIGINT NOT NULL
Create index multicolumnindex on TABLEA(SERVER, Volume, ID, Key);
or
Create table TABLEA
SERVER_VOLUME_ID_KEY VARCHAR(40) //will be something like
32-123-432-1287634-324938347437347347879
Create index onecolumnindex on TABLEA(SERVER_VOLUME_ID_KEY);
in the first variant i use only 16bytes and in the second 40 bytes..
but the data stored is the same and it's change nothing for our application