pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Glaesemann <grzm@seespotcode.net>
To: Michael Glaesemann <grzm@seespotcode.net>
Cc: novice <user.postgresql@gmail.com>
Cc: pgsql-general@postgresql.org, pgsql-sql@postgresql.org, "Osvaldo Rosario Kussama" <osvaldo_kussama@yahoo.com.br>
Subject: Re: [SQL] Join query help
Date: Mon, 20 Aug 2007 20:35:02 -0500
Message-ID: <311DDC69-7101-4591-99EC-8FFF4365C53B@seespotcode.net> (raw)
In-Reply-To: <D4BD78DC-5913-42D5-B1D7-7291AE9301E9@seespotcode.net>
References: <ddcb1c340708172235w3b07b912od246e76fa9109646@mail.gmail.com>
	<ddcb1c340708172311s47a565a5t49ffb8c14acac7d@mail.gmail.com>
	<46C9E9A7.1080409@yahoo.com.br>
	<ddcb1c340708201752q15c61688t7e3f04387c6cdd38@mail.gmail.com>
	<D4BD78DC-5913-42D5-B1D7-7291AE9301E9@seespotcode.net>


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





view thread (9+ messages)  latest in thread

Message-ID: <311DDC69-7101-4591-99EC-8FFF4365C53B@seespotcode.net>
Permalink:  ../311DDC69-7101-4591-99EC-8FFF4365C53B@seespotcode.net/
Also on:    postgresql.org/message-id/311DDC69-7101-4591-99EC-8FFF4365C53B@seespotcode.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: grzm@seespotcode.net, user.postgresql@gmail.com, osvaldo_kussama@yahoo.com.br
  Subject: Re: [SQL] Join query help
  In-Reply-To: <311DDC69-7101-4591-99EC-8FFF4365C53B@seespotcode.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox