Subject | Re: [firebird-support] Order of rows returned by stored procedures |
---|---|
Author | Helen Borrie |
Post date | 2011-12-08T07:59:55Z |
At 08:30 PM 8/12/2011, Josef KokeĀ wrote:
./hb
>*Returned* is obvious. But if I *read* these returned rows and outputIt's a documented behaviour that a SSP outputs rows in the order that your code sends them via a SUSPEND.
>them again, is it a documented behavior that the output will reflect the
>ordering from the stored procedure?
>> It is much more efficient to have your SSP work with an ordered set, as"A growing sequence". What's that? If your code steps through an ordered set in a FOR SELECT loop, it can't do anything else but spit out the "next row" each time. It's entirely up to the ORDER BY clause that's producing that set: it will come out in that order, exactly one row at a time. REALLY. One row out to the buffer for each SUSPEND. Execution inside the SP won't continue until the caller fetches that ONE ROW out of the buffer.
>> the FOR SELECT inside the SP can use indexes. Ordering the set of
>> virtual output is a sloooooow process and of course there are no indexes
>> to call on.
>
>Of course. But that's not the issue here. The issue is, if my procedure
>returns a growing sequence, can I depend on it always being growing or
>should I make sure by an explicit order outside of the procedure?
./hb