Re: [SQL] Select very slow...

Поиск
Список
Период
Сортировка
От Roberto Mello
Тема Re: [SQL] Select very slow...
Дата
Msg-id 20010318085154.B10431@cc.usu.edu
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: Revamped PL/pgSQL Docs (corrected)
Следующее
От: Philip Crotwell
Дата:
Сообщение: suggestion for admin "If you are upgrading"