Re: Permanent alias for postgresql table

From: Mina R Waheeb <syncer(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org, Marco Lechner <marco(dot)lechner(at)geographie(dot)uni-freiburg(dot)de>
Subject: Re: Permanent alias for postgresql table
Date: 2009-03-13 18:38:06
Message-ID: 275890790903131138s49d4ed86i437256af857d41a6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,
Somewhere the query should be rewritten, on the server side with a VIEW
or FUNCTION or in the query generator (SQL client side). If you worry about
the performance create a test case and test the performance, Also EXPLAIN
could help you. The VIEW is optimized by the server and it will be better
than custom FUNCTION, go VIEW if you don't frequently create a new version
of the table.

Its hard to apply versioning concept in current SQL model/implementation, By
using this approach you will lose a lot of the engine features and you will
have to rewrite them on your own for example foreign keys. If you really
have a lot of objects represented in tables and you plan to have unknown
number of versions for each table/object then I believe you should
reconsider your approach.

Best regards,
Mina R Waheeb

On Thu, Mar 12, 2009 at 6:54 PM, Lennin Caro <lennin(dot)caro(at)yahoo(dot)com> wrote:

>
> -- On Thu, 3/12/09, Marco Lechner <
> marco(dot)lechner(at)geographie(dot)uni-freiburg(dot)de> wrote:
>
> > From: Marco Lechner <marco(dot)lechner(at)geographie(dot)uni-freiburg(dot)de>
> > Subject: Re: [SQL] Permanent alias for postgresql table
> > To: pgsql-sql(at)postgresql(dot)org
> > Date: Thursday, March 12, 2009, 2:26 PM
> > Hi Mina,
> >
> > thanks for your answer. I thought about that, but don't
> > views decrease performance, because they are
> > "calculated"
> > on access?
> >
> > Marco
> >
> > On Thu, 12 Mar 2009 13:34:39 +0000
> > Mina R Waheeb <syncer(at)gmail(dot)com> wrote:
> > > Use views,
> > >
> > > mytablev1 and we have a view mytable selecting * from
> > > mytablev1
> > > and when we need to update the target we alter the
> > view
> > > to select from
> > > mytablev2
> > >
> > > On Thu, Mar 12, 2009 at 12:59 PM, Marco Lechner <
> > > marco(dot)lechner(at)geographie(dot)uni-freiburg(dot)de> wrote:
> > >
> > > > Hi list,
> > > >
> > > > I'm searching for a way to create permanent
> > alias for
> > > > tablenames in postgresql. We are storing various
> > > versions
> > > > of a routable network in postgresql (postgis,
> > > pgrouting)
> > > > and access a certain version with a bunch of
> > > php-skripts.
> > > > We like to use aliases for the "currently
> > used tables"
> > > oo
> > > > be able to relink the current tables rapidly by
> > > changing
> > > > the alias target.
> > > >
> > > > Any idea - or is this approach nonsense?
> > > >
> > > > Marco
> > > >
> > > > --
> > > > Sent via pgsql-sql mailing list
> > > (pgsql-sql(at)postgresql(dot)org)
> > > > To make changes to your subscription:
> > > > http://www.postgresql.org/mailpref/pgsql-sql
> > > >
> >
> >
> > --
> > Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-sql
>
> you can use partition table, whit a column whit the version of the data and
> create the partition for this column....
>
>
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2009-03-13 19:43:24 Re: select count of all overlapping geometries and return 0 if none.
Previous Message Steve Midgley 2009-03-13 17:32:36 Re: select count of all overlapping geometries and return 0 if none.