Re: Question about SPI_prepare

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Sam Mason <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Question about SPI_prepare
Date: 2008-11-11 18:26:38
Message-ID: 4919CE5E.3050705@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sam Mason wrote:
> On Tue, Nov 11, 2008 at 11:33:41AM -0600, Tim Keitt wrote:
>
>> I have an application where I am building a plan with SPI_plan and
>> then this plan is called multiple times. There is one free parameter
>> ($1) to the plan. The issue is with the order of the values returned.
>> If $1 is identical during successive calls to SPI_execute_plan, is
>> there any guarantee that the rows will be returned in the same order?
>>
>
> No, AFAIK SeqScans will start from different places if there's someone
> else doing a scan on the table (or has done recently).
>
>
>
>

Not only that, but the physical order of rows in the table is not
constant. It can be changed by any insert/update/delete. If you need the
rows in some order, use ORDER BY.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ron Mayer 2008-11-11 18:32:35 Re: Re: Updated interval patches (SQL std output, ISO8601 intervals, and interval rounding)
Previous Message Joshua Tolley 2008-11-11 18:22:29 Re: Question about SPI_prepare