Search Postgresql Archives

Re: Indexes

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

 



Peter Wilson wrote:
> Jake Stride wrote:
>> Hi,
>>
>> I have a table set up:
>>
>> \d companycontactmethod
>>           Table "public.companycontactmethod"
>>   Column   |       Type        |       Modifiers
>> -----------+-------------------+------------------------
>>  tag       | character varying | not null
>>  contact   | character varying | not null
>>  type      | character(1)      | not null
>>  companyid | bigint            | not null
>>  name      | character varying | not null
>>  main      | boolean           | not null default false
>>  billing   | boolean           | not null default false
>>  shipping  | boolean           | not null default false
>>  payment   | boolean           | not null default false
>>  technical | boolean           | not null default false
>> Indexes:
>>     "companycontactmethod_pkey" PRIMARY KEY, btree (companyid, name,
>> "type")
>>     "companycontactmethod_companyid" btree (companyid)
>>     "companycontactmethod_main_type" btree (main, "type")
>> Foreign-key constraints:
>>     "$1" FOREIGN KEY (companyid) REFERENCES company(id) ON UPDATE
>> CASCADE ON DELETE CASCADE
>>
>>
>
> The index is of no use when you specify no value for main. You want
> any row that has any value for main, and a value of 'E' for type.
> Because you haven't specified a value for 'main' the only solution is
> to scan the entire set.
>
> Pete
Does saying 'main' not mean where main=true as it is a boolean

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

[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