On Wednesday 05 Mar 2003 3:02 pm, Greg Stark wrote:
> Richard Huxton <dev@archonet.com> writes:
> > Filter: ((line_id)::text = '0912345 0004'::text)
>
> So I think this means that line_id is being casted to "text". Though I'm
> not clear why it would be choosing "text" for the constant if line_id
> wasn't text to begin with.
A domain defined as varchar() actually - which is why it's not using an index,
but that's neither here nor there regarding the constant issue.
> In any case my plans here look like:
> > Filter: (aa = 'x'::text)
>
> so it looks like there's something extra going on in your plan.
>
> what does your table definition look like?
rms=> \d campaign
Table "rms.campaign"
Column | Type | Modifiers
----------+-----------+-----------
id | integer | not null
title | item_name |
cam_from | date |
cam_to | date |
owner | integer |
Indexes: campaign_pkey primary key btree (id),
campaign_from_idx btree (cam_from),
campaign_to_idx btree (cam_to)
rms=> \d campaign_items
Table "rms.campaign_items"
Column | Type | Modifiers
-------------+---------+-----------
cam_id | integer | not null
line_id | tel_num | not null
prod_id | integer | not null
chg_per_min | integer |
rev_per_min | integer |
Indexes: campaign_items_pkey primary key btree (cam_id, line_id, prod_id),
cam_item_line_idx btree (line_id)
Foreign Key constraints: $1 FOREIGN KEY (cam_id) REFERENCES campaign(id) ON
UPDATE NO ACTION ON DELETE NO ACTION,
$2 FOREIGN KEY (line_id) REFERENCES line(telno) ON
UPDATE NO ACTION ON DELETE NO ACTION,
$3 FOREIGN KEY (prod_id) REFERENCES product(id) ON
UPDATE NO ACTION ON DELETE NO ACTION
rms=> \d activity
Table "rms.activity"
Column | Type | Modifiers
------------+-----------------------------+-----------
line_id | tel_num | not null
start_time | timestamp without time zone | not null
call_dur | integer |
Indexes: activity_pkey primary key btree (line_id, start_time),
activity_start_idx btree (start_time)
Foreign Key constraints: $1 FOREIGN KEY (line_id) REFERENCES line(telno) ON
UPDATE NO ACTION ON DELETE NO ACTION
--
Richard Huxton