Re: [GENERAL] Join query help - Mailing list pgsql-sql

From Michael Glaesemann
Subject Re: [GENERAL] Join query help
Date
Msg-id 311DDC69-7101-4591-99EC-8FFF4365C53B@seespotcode.net
Whole thread Raw
In response to Re: [GENERAL] Join query help  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-sql
On Aug 20, 2007, at 20:27 , Michael Glaesemann wrote:

> Note: record_id is in integer, yet you're quoting the value ('1').
> This causes the server to cast the text value to an integer. Here
> it's not going to cause much of a problem, just a couple CPU
> cycles. In table definitions (and possibly queries?) it can cause
> the server to ignore otherwise usable indexes when planning
> queries. (I see below your other inserts also quote integer values:
> you should drop the quotes there as well.)

Some clarification: what I meant by "table definitions" is if you're
actually defining text columns that reference integer columns. For
example:

CREATE TABLE foos (foo_id INTEGER PRIMARY KEY, foo text NOT NULL
UNIQUE);
CREATE TABLE bars (bar text PRIMARY KEY, foo_id text NOT NULL
REFERENCES foos (foo_id));

Michael Glaesemann
grzm seespotcode net



pgsql-sql by date:

Previous
From: novice
Date:
Subject: Re: [GENERAL] Join query help
Next
From: Michael Glaesemann
Date:
Subject: Re: [GENERAL] Join query help