Re: parameterized views?

From: "Linn Kubler" <lkubler(at)ecw2(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: parameterized views?
Date: 2002-09-03 17:19:03
Message-ID: al2qu7$2445$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


"Joe Conway" <mail(at)joeconway(dot)com> wrote in message
news:3D74E5E5(dot)9070309(at)joeconway(dot)com(dot)(dot)(dot)
> Linn Kubler wrote:
> > Thanks for responding Joe but, not exactly. I'm looking for something
> > more like this:
> >
> > create view myview as
> > select f1, f2, f3 from mytable where f3 = $1;
> >
> > And then be able to call the view passing it a parameter somehow.
> > Possibly like:
> >
> > select * from myview where f3 = 15;
>
> I believe the optimizer will see this as exactly the same query as
> create view myview as
> select f1, f2, f3 from mytable;
> select * from myview where f3 = 15;
> so I don't think you'd get any different execution time.
>
> Are you looking to avoid parsing overhead, similar to a prepared
> statement (also new in 7.3)? In any case what you're looking for does
> not exist currently, and I don't know of anyone working on it.
>
> > Something like that. Returning sets from a function looks promising as
> > you described below but, 7.3 seems like it's a long way off if it's just
> > going to beta now.
>
> It depends how you define "a long way off". I'd *guess* 7.3 will be
> released within about 2 months of starting beta -- but no promises of
> course.
>
> Joe

It's not execution time that I'm trying to save here, that isn't an issue
for my database. I'm looking to have a view defined where I can get a
subset of the records returned based on a parameter. Sure would be a handy
feature for me. The other option I suppose is to have multiple views
defiened for each senario and then have the front end pick the appropriate
view. That just seems like a lot of work and won't be as flexible.

Thanks again,
Linn

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Linn Kubler 2002-09-03 17:26:25 Re: parameterized views?
Previous Message Justin Clift 2002-09-03 17:18:55 Re: Where can I find more information of XML support in