Re: table test - Mailing list pgsql-admin

From Nick Fankhauser
Subject Re: table test
Date
Msg-id NEBBLAAHGLEEPCGOBHDGEEPLDPAA.nickf@ontko.com
Whole thread Raw
In response to Re: table test  (Manuel Trujillo <manueltrujillo@dorna.es>)
Responses Re: table test
List pgsql-admin
Manuel-

I'm still a bit confused, but will try to answer (maybe someone else can
jump in with a better interpretation).

Generally, the structure of the information you are storing should determine
the structure of the tables, so if there are three distinct fields in the
data, table one would be best, but if there are seven distinct fields, table
two would be best.

Regarding speed, fewer records (rows), will always result in faster access
to the *record*, but if you then have to search among the fields (columns)
within each record to get to the bit of data you need, then the gain is
lost. That is why you should usually make the database structure closely
match the information to be stored. This foundation starts you with the best
situation.

This is true regardless of the datatypes of the fields. There are probably a
few exceptions, but this rule is true for most situations.

The nature of your question has more to do with table structure than
database administration, so I'd suggest going to the pgsql-sql or
pgsql-general lists in the future- you might get better answers there.

-Nick

--------------------------------------------------------------------------
Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/



> -----Original Message-----
> From: pgsql-admin-owner@postgresql.org
> [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Manuel Trujillo
> Sent: Friday, November 30, 2001 3:47 AM
> To: Nick Fankhauser
> Cc: pgsql-admin@postgresql.org
> Subject: Re: [ADMIN] table test
>
>
> On Thu, Nov 29, 2001 at 12:12:04PM -0500, Nick Fankhauser wrote:
> > I did not understand the question. Can you restate your purpose
> or tell us
> > more about what you are trying to achieve?
> >
> > (No entendía la pregunta.  ¿Puede usted exponer su propósito en forma
> > modificada o decirnos más sobre lo que usted está intentando alcanzar?)
>
> Yes. We are try to achieve fields of "varchar" (with
> indeterminate lenght, my boss is too bit explicit).
> He only want to know, how is the fastest access to this table;
> with the manner like "Table One", or the "Table Two".
> Each table have only "varchar characters", about to 20-50
> characters of maximum lenght (I would like to think :().
>
> > > > Table One:            Table Two:
> > > >   1 |  2 |  3 |            1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
> > > > ---------------           -----------------------------------------
> > > > 1|__|____|____|         1 ___|___|___|___|___|___|___|___|___|____|
> > > > 2|__|____|____|         2 ___|___|___|___|___|___|___|___|___|____|
> > > > .
> > > > .
> > > > .
> > > > 7|__|____|____|
> > > >
> > > >
> > > > How is the best way to know the better type of table of
> this two types?
>
> Thank you very much.
>
> Have a nice day ;-)
> TooManySecrets
>
> --
> Manuel Trujillo         manueltrujillo@dorna.es
> Technical Engineer      http://www.motograndprix.com
> Dorna Sports S.L.       +34 93 4702864
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>


pgsql-admin by date:

Previous
From: Manuel Trujillo
Date:
Subject: wiew's & cache
Next
From: Oliver Vecernik
Date:
Subject: locale question