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

Re: Simple function question

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>,Postgres <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Simple function question
Date: 2004-10-27 13:25:25
Message-ID: 20041027132525.GB3160@wolff.to (view raw or flat)
Thread:
Lists: pgsql-novice
On Tue, Oct 26, 2004 at 09:49:43 -0400,
  Sean Davis <sdavis2(at)mail(dot)nih(dot)gov> wrote:
> 
> 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)?

For this kind of task you probably don't want to use arrays. There should
be a table matching sets to the ids that are in them. Then you would be able
to get the information you want using normal queries.

In response to

pgsql-novice by date

Next:From: Deepa KDate: 2004-10-27 14:22:10
Subject: ABRUPT CLOSURE OF POSTGRESQL SOCKET
Previous:From: Kjetil HaalandDate: 2004-10-27 11:59:56
Subject: using palloc in extension functions in c

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