Re: select few fields as a single field - Mailing list pgsql-general

From Roman Gavrilov
Subject Re: select few fields as a single field
Date
Msg-id 3C3D84B7.2ED63602@il.aduva.com
Whole thread Raw
In response to select few fields as a single field  (Roman Gavrilov <romio@il.aduva.com>)
Responses Re: select few fields as a single field  (John Gray <jgray@azuli.co.uk>)
List 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@rationalizer.com

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

pgsql-general by date:

Previous
From: "Alaric B. Snell"
Date:
Subject: Re: Query planner isn't using my indices
Next
From: "Alaric B. Snell"
Date:
Subject: Re: caching subtotals: update vs sum -- aaugh!