pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Roberto Mello <rmello@cc.usu.edu>
To: pgsql-docs@postgresql.org
Subject: Re: [SQL] Select very slow...
Date: Sun, 18 Mar 2001 08:51:54 -0700
Message-ID: <20010318085154.B10431@cc.usu.edu> (raw)


On Sun, Mar 18, 2001 at 06:15:42AM -0300, Fernando Eduardo B. L. e Carvalho wrote:
> 
>     Table  1
> 
>     create table person (
> 
>                  doc text primary key,
                       ^^^^^^^^^^^^^^^^

	The "text" datatype is for columns that usually will store big text
segments. It's not a good idea to put this as primary key (which implies
that there can never be two equal "doc" records).
	It would be better if you had something like "person_id integer
primary key" or "person_id serial primary key".
 	What's stored in the "doc" column?
 
>   select  p.city,count(*) from sales s, person p where s.doc = p.doc
> group by p.city;

	If you have big chunks of text in the doc column, PG has look for a
match in these two columns. If you give us more details on what you are
trying to do, we could help more.
	Se voce fala portugues, eu posso responder em portugues tambem.

	-Roberto
-- 
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club|------+
  Roberto Mello - Computer Science, USU - http://www.brasileiro.net 
      http://www.sdl.usu.edu - Space Dynamics Lab, Web Developer    
H y! Wh r  did my " " k y go?



Message-ID: <20010318085154.B10431@cc.usu.edu>
Permalink:  ../20010318085154.B10431@cc.usu.edu/
Also on:    postgresql.org/message-id/20010318085154.B10431@cc.usu.edu

 · 

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-docs@postgresql.org
  Cc: rmello@cc.usu.edu
  Subject: Re: [SQL] Select very slow...
  In-Reply-To: <20010318085154.B10431@cc.usu.edu>

* 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