Re: Optimizer not using index on 120M row table - Mailing list pgsql-general

From Tom Lane
Subject Re: Optimizer not using index on 120M row table
Date
Msg-id 24163.1049773877@sss.pgh.pa.us
Whole thread Raw
In response to Optimizer not using index on 120M row table  ("Jim C. Nasby" <jim@nasby.net>)
Responses Re: Optimizer not using index on 120M row table  ("Jim C. Nasby" <jim@nasby.net>)
List pgsql-general
"Jim C. Nasby" <jim@nasby.net> writes:
>  project_id | smallint      | not null

>  explain select * from email_contrib where project_id=8 and id=39622 and
> date='3/1/03';

Cast the constants to smallint, eg

    project_id = 8::smallint and ...

or quote them if that feels cleaner to you:

    project_id = '8' and ...

or just declare project_id to be integer (hint: the space savings are
completely illusory in this example, anyway, because of alignment
requirements).

See the archives for much prior discussion ;-)

            regards, tom lane


pgsql-general by date:

Previous
From: Neil Conway
Date:
Subject: Re: Optimizer not using index on 120M row table
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Optimizer not using index on 120M row table