On Sun, Aug 23, 2009 at 1:30 AM, John DeSoi wrote:
> While it avoids the sort of my method, it appears to be almost 5 times
> slower (about 4000 keys in the cursor, Postgres 8.4.0):
>
>
> Function Scan on cursor_pk arr (cost=0.00..116011.72 rows=1000 width=4)
> (actual time=13.561..249.916 rows=43
On Aug 21, 2009, at 9:22 AM, Greg Stark wrote:
Of course immediately upon hitting send I did think of a way:
SELECT (r).*
FROM (SELECT (SELECT x FROM x WHERE a=id) AS r
FROM unnest(array[1,2]) AS arr(id)
) AS subq;
Thanks to all for the interesting insights and discussion. Wh
On Fri, Aug 21, 2009 at 01:58:34PM -0400, Merlin Moncure wrote:
> On Fri, Aug 21, 2009 at 1:13 PM, Sam Mason wrote:
> > On Fri, Aug 21, 2009 at 12:05:51PM -0400, Tom Lane wrote:
> >> We might be able to do that based on the row-returning-subselect
> >> infrastructure being discussed over here:
> >>
On Fri, Aug 21, 2009 at 1:13 PM, Sam Mason wrote:
> On Fri, Aug 21, 2009 at 12:05:51PM -0400, Tom Lane wrote:
>> Sam Mason writes:
>> > ... PG should instead arrange that the expression
>> > "t" is run exactly once and reuse the single result for all columns.
>>
>> We might be able to do that base
On Fri, Aug 21, 2009 at 12:05:51PM -0400, Tom Lane wrote:
> Sam Mason writes:
> > ... PG should instead arrange that the expression
> > "t" is run exactly once and reuse the single result for all columns.
>
> We might be able to do that based on the row-returning-subselect
> infrastructure being
Sam Mason writes:
> ... PG should instead arrange that the expression
> "t" is run exactly once and reuse the single result for all columns.
We might be able to do that based on the row-returning-subselect
infrastructure being discussed over here:
http://archives.postgresql.org/message-id/4087.12
On Fri, Aug 21, 2009 at 10:49:52AM -0400, Merlin Moncure wrote:
> On Fri, Aug 21, 2009 at 10:17 AM, Sam Mason wrote:
> > CREATE TYPE foo AS ( i int, j int );
> >
> > SELECT (id((SELECT (1,2)::foo))).*;
> >
> > or am I missing something obvious?
>
> I think that what you are bumping in to is th
On Fri, Aug 21, 2009 at 10:17 AM, Sam Mason wrote:
> On Fri, Aug 21, 2009 at 02:22:54PM +0100, Greg Stark wrote:
>> SELECT (r).*
>> FROM (SELECT (SELECT x FROM x WHERE a=id) AS r
>> FROM unnest(array[1,2]) AS arr(id)
>> ) AS subq;
>
> Shouldn't that second inner SELECT unnecessa
On Fri, Aug 21, 2009 at 02:22:54PM +0100, Greg Stark wrote:
> SELECT (r).*
> FROM (SELECT (SELECT x FROM x WHERE a=id) AS r
> FROM unnest(array[1,2]) AS arr(id)
>) AS subq;
Shouldn't that second inner SELECT unnecessary? I'd be tempted to
write:
SELECT ((SELECT x FROM x WH
On Fri, Aug 21, 2009 at 9:22 AM, Greg Stark wrote:
> Of course immediately upon hitting send I did think of a way:
>
> SELECT (r).*
> FROM (SELECT (SELECT x FROM x WHERE a=id) AS r
> FROM unnest(array[1,2]) AS arr(id)
> ) AS subq;
nice use of composite type in select-list subquery
On Fri, Aug 21, 2009 at 2:16 PM, Greg Stark wrote:
> On Fri, Aug 21, 2009 at 1:16 PM, John DeSoi wrote:
>>
>> Yes, this is the best I have come up with so far. I have a set returning
>> function which returns the key and the index number. The implementation with
>> a cursor looks like this:
>>
>> S
On Fri, Aug 21, 2009 at 1:16 PM, John DeSoi wrote:
>
> Yes, this is the best I have come up with so far. I have a set returning
> function which returns the key and the index number. The implementation with
> a cursor looks like this:
>
> SELECT * FROM cursor_pk('c1') c LEFT JOIN foo ON (c.pk = foo
On Aug 21, 2009, at 7:26 AM, Sam Mason wrote:
It may help to wrap the generate_series call into a function so you
don't have to refer to "myPkArray" so many times.
Yes, this is the best I have come up with so far. I have a set
returning function which returns the key and the index number. T
On Thu, Aug 20, 2009 at 11:15:12PM -0400, John DeSoi wrote:
> Suppose I have an integer array (or cursor with one integer column)
> which represents primary keys of some table. Is there a simple and
> efficient way to return the rows of the table corresponding to the
> primary key values and
John DeSoi wrote:
Suppose I have an integer array (or cursor with one integer column)
which represents primary keys of some table. Is there a simple and
efficient way to return the rows of the table corresponding to the
primary key values and keep them in the same order as the array (or
cursor
Suppose I have an integer array (or cursor with one integer column)
which represents primary keys of some table. Is there a simple and
efficient way to return the rows of the table corresponding to the
primary key values and keep them in the same order as the array (or
cursor)? Seems like i
16 matches
Mail list logo