Search Postgresql Archives

Re: [SQL] Join query help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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



---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux