Re: select few fields as a single field

From: Roman Gavrilov <romio(at)il(dot)aduva(dot)com>
To: Holger Krug <hkrug(at)rationalizer(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: select few fields as a single field
Date: 2002-01-10 12:10:31
Message-ID: 3C3D84B7.2ED63602@il.aduva.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ok I think after all I will use view.
However i'll have to join many tables in the view want it slow the performance
dramatically ?
I run explain on the view and got
explain select event_id from get_event;
NOTICE: QUERY PLAN:
Merge Join (cost=376812.28..389383.78 rows=10000000 width=60)
when the biggest table contains 40 records only

when explain select event_id from intelligence; :
NOTICE: QUERY PLAN:
Seq Scan on intelligence (cost=0.00..20.00 rows=1000 width=4)

Holger Krug wrote:

> On Thu, Jan 10, 2002 at 12:58:18PM +0200, Roman Gavrilov wrote:
> > Thank you for your response.
> > Yes I know that i can make a function.
> > Is there a way to do this transparently I want to treat this function as a
> > field in the table.
>
> No.
>
> > The reason why i want to do that is because i have a class that has generic
> > method to retrieve data.
> > It receives list of field names and returns their values from the table.
> > If I want to implement the function method i will have to modify the class
> > method and will have to treat specially the
> > retrieve fullname thing.
>
> OK. But why not views ? That's exactly the use case where views should
> be used in PostgreSQL. Using views you need not modify anything in
> your class.
>
> Alternative solution:
>
> Change your class (if possible) to have the members name, version,
> release and add a method getFullName() to the class. (I would never
> do this but use views.)
>
> --
> Holger Krug
> hkrug(at)rationalizer(dot)com

--
-----------------------------------------------------------------------------
Roman Gavrilov
Aduva Inc., Web Development Services.
work +972-3-7534324 mobile +972-54-834668
romio(at)aduva(dot)com, romio(at)netvision(dot)net(dot)il

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alaric B. Snell 2002-01-10 12:18:33 Re: Query planner isn't using my indices
Previous Message Holger Krug 2002-01-10 11:09:10 Re: select few fields as a single field