Re: ??? Multiple selects in procedure

From: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>
To: "Ivar" <ivar(at)lumisoft(dot)ee>
Cc: "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ??? Multiple selects in procedure
Date: 2003-01-26 12:11:35
Message-ID: 200301261211.35608.darko.prenosil@finteh.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)prenosil(at)finteh(dot)hr>
> To: "Ivar" <ivar(at)lumisoft(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message greg 2003-01-26 14:25:16 Re: Searchable 7.3.1 Documentation - now interactive!
Previous Message Jeffrey Melloy 2003-01-26 08:23:16 Re: Can object oriented table design help to solve this problem?