Re: [SQL] Select very slow... - Mailing list pgsql-docs

From Roberto Mello
Subject Re: [SQL] Select very slow...
Date
Msg-id 20010318085154.B10431@cc.usu.edu
Whole thread Raw
List pgsql-docs
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?

pgsql-docs by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: Revamped PL/pgSQL Docs (corrected)
Next
From: Philip Crotwell
Date:
Subject: suggestion for admin "If you are upgrading"