On Mon, 2006-11-27 at 17:05 -0500, Tom Lane wrote:
> Jeff Davis <[EMAIL PROTECTED]> writes:
> > On Mon, 2006-11-27 at 12:44 -0800, Ron Mayer wrote:
> >> Shouldn't the results of this query shown here been sorted by "b" rather
> >> than by "a"?
>
> >> li=# select * from (select (random()*10)::int
Ron Mayer <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> It looks to me like the planner thinks that order by a and order by b
>> are equivalent because the expressions are equal(); hence it discards
>> what it thinks is a redundant second sort step.
> Would it be a smaller waste of cycles and s
I wrote:
> It looks to me like the planner thinks that order by a and order by b
> are equivalent because the expressions are equal(); hence it discards
> what it thinks is a redundant second sort step.
> ... What's the use-case for sorting by a volatile
> expression in the first place?
It may be
Tom Lane wrote:
> Jeff Davis <[EMAIL PROTECTED]> writes:
>> On Mon, 2006-11-27 at 12:44 -0800, Ron Mayer wrote:
>>> li=# select * from (select (random()*10)::int as a, (random()*10)::int as b
>>> from generate_series(1,10) order by a) as x order by b;
>
>> It looks like a planner bug.
>
> It loo
Jeff Davis wrote:
> On Mon, 2006-11-27 at 12:44 -0800, Ron Mayer wrote:
>> Shouldn't the results of this query shown here been sorted by "b" rather
>> than by "a"?
>>
>> I would have thought since "order by b" is in the outer sql statement it
>> would have
>> been the one the final result gets or
Jeff Davis <[EMAIL PROTECTED]> writes:
> On Mon, 2006-11-27 at 12:44 -0800, Ron Mayer wrote:
>> Shouldn't the results of this query shown here been sorted by "b" rather
>> than by "a"?
>> li=# select * from (select (random()*10)::int as a, (random()*10)::int as b
>> from generate_series(1,10) or
On Mon, 2006-11-27 at 12:44 -0800, Ron Mayer wrote:
> Shouldn't the results of this query shown here been sorted by "b" rather than
> by "a"?
>
> I would have thought since "order by b" is in the outer sql statement it
> would have
> been the one the final result gets ordered by.
>
> li=# selec
Shouldn't the results of this query shown here been sorted by "b" rather than
by "a"?
I would have thought since "order by b" is in the outer sql statement it would
have
been the one the final result gets ordered by.
li=# select * from (select (random()*10)::int as a, (random()*10)::int as b
f