Re: ??? Multiple selects in procedure - Mailing list pgsql-general

From Darko Prenosil
Subject Re: ??? Multiple selects in procedure
Date
Msg-id 200301261211.35608.darko.prenosil@finteh.hr
Whole thread Raw
In response to ??? Multiple selects in procedure  ("Ivar" <ivar@lumisoft.ee>)
List pgsql-general
On Friday 24 January 2003 09:38, Ivar wrote:
> Hi,
>
> >probably sign of poor database design
>
> I won't agree with it.
>
I did say probably, not definitely !

> For example you need return document from server.
> document structure
> Header - header fields
> Detail   - document rows
>
> In c# I just  exec procedure and read tables.
>
> ds.Tables[0].TableName = "Detail";
> ds.Tables[1].TableName = "Header";
>
> Some header columns are sum of detail, if you won't get them from one
> procedure, you must select twice Detail rows (once for detail itshelf and
> for header row sums) - this is very big over head(tme,cpu,..). Tmp tables
> can't be used, because program works over webservices.

When I need the speed, I always use redundant fields -sums in headers are
actual fields which are updated by triggers from detail fields. In this
scenario, only updates are little slower(updates are very rare if you compare
it with selects ?), but selects can be very fast. If you also make those sums
"read only" for regular user using triggers, this can be a solution.

> With mssql it works perfectly, but cost of mssql ... .
>
I'm familiar with MSSQL 2000, and there is much more features in MSSQL that
PostgreSQL does not support, but ...



> See attachment, there are rules which I'll play.
>
> ----- Original Message -----
> From: "Darko Prenosil" <darko.prenosil@finteh.hr>
> To: "Ivar" <ivar@lumisoft.ee>
> Sent: Friday, January 24, 2003 12:13 PM
> Subject: Re: [GENERAL] ??? Multiple selects in procedure
>
> On Wednesday 22 January 2003 13:20, Ivar wrote:
> > Hi,
> >
> > Can there be multiple selects in function ?
>
> You can have multiple selects in one function.
>
> > Can function return multiple selects as mssql ?
>
> No, only one result can be returned (IMHO returning multiple result from a
> function is probably sign of poor database design). You can for example
> create more than one temp table in function.
>
> > I'm trying to find some thing out,but help file is ... .
>
> Procedural languages:
> http://developer.postgresql.org/docs/postgres/programmer-pl.html
> SQL functions:
> http://developer.postgresql.org/docs/postgres/xfunc.html
>
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org


pgsql-general by date:

Previous
From: Jeffrey Melloy
Date:
Subject: Re: Can object oriented table design help to solve this problem?
Next
From: greg@turnstep.com
Date:
Subject: Re: Searchable 7.3.1 Documentation - now interactive!