Re: Indexes - Mailing list pgsql-general

From Jake Stride
Subject Re: Indexes
Date
Msg-id 42EF700E.50003@users.sourceforge.net
Whole thread Raw
In response to Re: Indexes  (Peter Wilson <petew@yellowhawk.co.uk>)
Responses Re: Indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Dan Sugalski
Date:
Subject: Re: feeding big script to psql
Next
From: Samuel Thoraval
Date:
Subject: System catalog diagram