About when we should setup index?
От | Emi Lu |
---|---|
Тема | About when we should setup index? |
Дата | |
Msg-id | 440C950B.3020607@encs.concordia.ca обсуждение исходный текст |
Ответы |
Re: About when we should setup index?
|
Список | pgsql-general |
Hello, I have some questions about index. For example, we have a table test(id varchar(7) not null primary key, name varchar(15) , sex varchar(1) , birth_date date, valid_in_table boolean not null, time_stamp timestamp not null default now() ); . id is the primary key, so a default unique index is generated automatically ? . if queries based on name are often, index should be setup for name? if there are 30,000 records, 29,000 records' names are different, will the index for name still be useful? . possible values for sex are F/M and null, should we setup index for sex? . How about index for date and timestamp? Basically, I'd like to know is there a percentage of the differences among data to decide whether index will help or not? For example, among 30,000 records, for a column, its value choices are less than A% and greater than B% so that we know index will help a lot? thanks a lot! Emi
В списке pgsql-general по дате отправления: