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

Re: Simple function question

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
Cc: Postgres <pgsql-novice(at)postgresql(dot)org>,Michael Fuhr <mike(at)fuhr(dot)org>
Subject: Re: Simple function question
Date: 2004-10-26 14:13:22
Message-ID: 31914AD8-2759-11D9-8C43-000A95D7BA10@mail.nih.gov (view raw or flat)
Thread:
Lists: pgsql-novice
On Oct 26, 2004, at 9:49 AM, Sean Davis wrote:

>>
>> You could return SETOF RECORD but then your queries will need to
>> provide a column definition list.  Another way would be to create
>> a custom type that describes a result record and return SETOF that
>> type.  But before you do any of this, perhaps you should think about
>> whether you really need a function at all, or whether you can use
>> views and WHERE clauses.
>>
>
> Michael,
>
> Thanks for the reply.  The reason all of this comes up is that I have 
> an application in which the user can create "sets" of IDs.  I then 
> want to be able to do logical operations on the sets of IDs and then 
> return the database objects based on the ID's in those sets.  I tried 
> the function version using "ANY" and the simple query using "IN" and 
> found an order of magnitude difference in speed (IN is faster).  So, 
> it appears that using views and where clauses is the way to go here.  
> One last question--is there a limit to the length of a SQL query (in 
> terms of characters), as some of these sets could be very large (up to 
> 40000 integers)?
>

Sorry.  Answered (partially) my own question.  max_expr_depth is set to 
10000 as default on my MacOS installation (7.4.3).

Sean


In response to

pgsql-novice by date

Next:From: Ron St-PierreDate: 2004-10-26 16:23:52
Subject: Re: [pgfsupport - Help] RE: A big red x
Previous:From: Sean DavisDate: 2004-10-26 13:49:43
Subject: Re: Simple function question

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