Subject | have one primary key only => better to have index or not? |
---|---|
Author | ehaerim |
Post date | 2011-12-23T05:50:44Z |
CREATE TABLE TEST(ITEM VARCHAR(20) NOT NULL PRIMARY KEY, VAL BLOB SUB_TYPE BINARY);
SELECT VAL FROM TEST WHERE ITEM = '...';
INSERT INTO TEST(ITEM, VAL) VALUES('...', ...);
SELECT FIRST 1 RIGHT(ITEM, 8) FROM TEST WHERE LEFT(ITEM, 8) = '...' ORDER BY ITEM DESC;
These are sql statements that I will use.
Is it better to create indexes for this table?
Someone told me that PRIMARY KEY field is automatically indexed internally. But I am not sure if it is true or not. Can anyone verify this?
thx
SELECT VAL FROM TEST WHERE ITEM = '...';
INSERT INTO TEST(ITEM, VAL) VALUES('...', ...);
SELECT FIRST 1 RIGHT(ITEM, 8) FROM TEST WHERE LEFT(ITEM, 8) = '...' ORDER BY ITEM DESC;
These are sql statements that I will use.
Is it better to create indexes for this table?
Someone told me that PRIMARY KEY field is automatically indexed internally. But I am not sure if it is true or not. Can anyone verify this?
thx