Skip site navigation (1) Skip section navigation (2)

Re: On the performance of views

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Shridhar Daithankar <shridhar(at)frodo(dot)hserus(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: On the performance of views
Date: 2004-01-28 16:02:21
Message-ID: 4017DD0D.6040200@potentialtech.com (view raw or flat)
Thread:
Lists: pgsql-performancepgsql-sql
Shridhar Daithankar wrote:
> Josh Berkus wrote:
> 
>> Bill,
>>
>>> Some functions they prototyped in MSSQL even return different types, 
>>> based
>>> on certian parameters, I'm not sure how I'll do this in Postgres, but 
>>> I'll
>>> have to figure something out.
>>
>> We support that as of 7.4.1 to an extent; check out "Polymorphic 
>> Functions".
> 
> To my understanding, polymorphism means more than one function with same 
> name but different signature(Sorry C++ days!!).
> 
> That still can not return rwos of two types in one call. At any moment, 
> rowset returned by a function call would be homogenous.
> 
> Is MSSQL allows to mix rows of two types in single function invocation, 
> I am sure that would be a hell lot of porting trouble..

These are two seperate problems.

1) Returning a homogenious set of rows, but the composition of those rows
    will not be known until run time, as a different set of logic will be
    done depending on the values of some parameters.
2) Returning what MSSQL calls "combined recordsets", which are many rows,
    but the rows are not homogenious.

As I see it, #1 can be solved by polymorphism in Postgres functions.

#2 has to be solved at the application level.  My solution so far has
been to create multiple Postgres functions, call each one in turn, join
the results in C, and return them as a structure via SOAP to the client.
May not be the easiest way to get it working, but it's working so far.
(although I'm always open to suggestions if someone knows of a better
way)

-- 
Bill Moran
Potential Technologies
http://www.potentialtech.com


In response to

Responses

pgsql-performance by date

Next:From: Tom LaneDate: 2004-01-28 16:49:12
Subject: Re: [SQL] postgres timeout.
Previous:From: Alexandra BirchDate: 2004-01-28 11:23:38
Subject: limit 1 and functional indexes

pgsql-sql by date

Next:From: Tom LaneDate: 2004-01-28 16:49:12
Subject: Re: [SQL] postgres timeout.
Previous:From: Przemysław SłupkowskiDate: 2004-01-28 13:39:11
Subject: managing users in postgresql 7.4.1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group