Search Postgresql Archives

About when we should setup index?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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








[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux