Обсуждение: AW: Please advise features in 7.1 (SUMMARY)

Поиск
Список
Период
Сортировка

AW: Please advise features in 7.1 (SUMMARY)

От
Zeugswetter Andreas SB
Дата:
> > This is a summary of replies.
> > 
> > 1. Calculated fields in table definitions . eg.
> > 
> >     Create table test (
> >              A Integer,
> >              B integer,
> >             the_sum   As  (A+B),
> > );
> > 
> > This functionality can be achieved through the use of views.
> 
> Using a view for this isn't quite the same functionality as a computed
> field, from what I understand, since the calculation will be done at
> SELECT time, rather than INSERT/UPDATE.

I would expect the calculated field from above example to be calculated
during select time also, no ? You don't want to waste disk space with something 
you can easily compute at runtime.

Andreas


Re: Please advise features in 7.1 (SUMMARY)

От
"Mitch Vincent"
Дата:
I guess it depends on what you're using it for -- disk space is cheap and
abundant anymore, I can see some advantages of having it computed only once
rather than X times, where X is the number of SELECTs as that could get
costly on really high traffic servers.. Costly not so much for simple
computations like that but more complex ones.

Just playing the devil's advocate a bit.

-Mitch

----- Original Message -----
From: "Zeugswetter Andreas SB" <ZeugswetterA@wien.spardat.at>
To: "'Ross J. Reedstrom'" <reedstrm@rice.edu>;
<pgsql-hackers@postgresql.org>
Sent: Tuesday, November 28, 2000 7:50 AM
Subject: AW: [HACKERS] Please advise features in 7.1 (SUMMARY)


>
> > > This is a summary of replies.
> > >
> > > 1. Calculated fields in table definitions . eg.
> > >
> > >     Create table test (
> > >              A Integer,
> > >              B integer,
> > >             the_sum   As  (A+B),
> > > );
> > >
> > > This functionality can be achieved through the use of views.
> >
> > Using a view for this isn't quite the same functionality as a computed
> > field, from what I understand, since the calculation will be done at
> > SELECT time, rather than INSERT/UPDATE.
>
> I would expect the calculated field from above example to be calculated
> during select time also, no ? You don't want to waste disk space with
something
> you can easily compute at runtime.
>
> Andreas
>