Re: [SQL] Join query help

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Michael Glaesemann <grzm(at)seespotcode(dot)net>
Cc: novice <user(dot)postgresql(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org, "Osvaldo Rosario Kussama" <osvaldo_kussama(at)yahoo(dot)com(dot)br>
Subject: Re: [SQL] Join query help
Date: 2007-08-21 01:35:02
Message-ID: 311DDC69-7101-4591-99EC-8FFF4365C53B@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2007-08-21 01:36:29 Re: Join query help
Previous Message novice 2007-08-21 01:33:27 Re: Join query help

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2007-08-21 01:36:29 Re: Join query help
Previous Message novice 2007-08-21 01:33:27 Re: Join query help