LucidDB / luciddb

DEFUNCT: See README
https://github.com/LucidDB/luciddb
Apache License 2.0
52 stars 24 forks source link

[FRG-66] VolcanoCost.isLe does not impose a total order #804

Open dynamobi-build opened 12 years ago

dynamobi-build commented 12 years ago

[reporter="jvs", created="Thu, 9 Mar 2006 16:28:34 -0500 (GMT-05:00)"] Here's the code:

    public boolean isLe(RelOptCost other)
    {
        VolcanoCost that = (VolcanoCost) other;
        return (this == that)
            || ((this.dRows <= that.dRows) && (this.dCpu <= that.dCpu)
            && (this.dIo <= that.dIo));
    }

Suppose I have costA(dRows=2,dCpu=3,dIo=4) and costB(dRows=2,dCpu=4,dIo=3).

The result of costA.isLe(costB) is false. But so is the result of costB.isLe(costA).

I expected that Volcano would want a total order instead; is that incorrect?

dynamobi-build commented 12 years ago

[author="jhyde", created="Thu, 9 Mar 2006 23:59:10 -0500 (GMT-05:00)"] Total and partial order both have their uses.

In order to do total order, you'd need an object which can convert a vector cost into a scalar (which is naturally totally ordered). This converter knows the relative importance of I/O and CPU for the target machine of the query, the current state and projected future state of the system.

If R1 < R2 according to the partial order, this means that it's a no-brainer: R1 is better than R2 regardless of the relative importance of I/O and CPU.

I'd like to hear Kirk's opinion on this -- he always used to have a lot to say on this topic. :)