Re: Indexes

From: Jake Stride <nsuk(at)users(dot)sourceforge(dot)net>
To: Peter Wilson <petew(at)yellowhawk(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Indexes
Date: 2005-08-02 13:07:26
Message-ID: 42EF700E.50003@users.sourceforge.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Samuel Thoraval 2005-08-02 13:10:20 System catalog diagram
Previous Message Dan Sugalski 2005-08-02 13:05:55 Re: feeding big script to psql