You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Put a breakpoint in lookupJoinSelectivity before the call to sql.NewLookupFDs
Run the following SQL:
drop table if exists one_pk;
create table one_pk (pk smallint primary key);
insert into one_pk values
(0),
(1),
(2),
(3);
SELECT a.* FROM one_pk a JOIN one_pk c JOIN one_pk b ON b.pk = c.pk and b.pk = a.pk;
As part of costing joins, we attempt to detect lookups that we know will always return at most one row. The joins here can be reordered, but regardless of the ordering, this is a perfect candidate of such a lookup: each table is a single column, which is a unique primary key. A lookup into such a table always has at most one result. So we expect that fds.HasMax1Row() within lookupJoinSelectivity should return true. But it returns false instead, and we fail to prioritize this execution plan.
The text was updated successfully, but these errors were encountered:
Put a breakpoint in
lookupJoinSelectivity
before the call tosql.NewLookupFDs
Run the following SQL:
As part of costing joins, we attempt to detect lookups that we know will always return at most one row. The joins here can be reordered, but regardless of the ordering, this is a perfect candidate of such a lookup: each table is a single column, which is a unique primary key. A lookup into such a table always has at most one result. So we expect that
fds.HasMax1Row()
withinlookupJoinSelectivity
should return true. But it returns false instead, and we fail to prioritize this execution plan.The text was updated successfully, but these errors were encountered: