UNIQUE constraint does not set tkey property on the corresponding BAT #3374
Last updated: 2016-06-23 10:24:06 +0200
Date: 2013-09-27 14:12:50 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
A UNIQUE constraint on a column does not set tkey property on the corresponding BAT.
This has a performance impact on the algorithms which check that property for optimization purposes and find it unset.
create table x as select distinct name from sys.tables with data;
This calls a BATsubselect, which does check the tkey property. It finds it unset, so it cannot compute the correct result estimate (which would be 1 in this case).
Another thing: it builds a hash table on the fly to perform a hash-select. But isn't a hash table already built and stored persistently, with the unique constraint? Can't that one be used?
Same considerations for join and other operators.
Date: 2013-10-09 14:41:56 +0200
unfortunately unique keys are not that unique, only if also the NOT NULL constraint holds we could set tkey.
Date: 2013-10-09 14:46:33 +0200
Then the key property should be set when a column is marked unique and not null.
Date: 2013-10-23 15:00:38 +0200
Date: 2013-10-24 18:18:43 +0200
Yes, the property is set as expected, thanks
Date: 2013-12-03 13:59:37 +0100
Feb2013-SP6 has been released.
Date: 2015-05-11 17:27:06 +0200
This issue was fixed in Feb2013 SP6, but it seems it's back in Oct2014.
A column marked NOT NULL and with a UNIQUE constraint does not have the tkey property set.
Date: 2015-05-20 21:57:09 +0200
with deletes (mark by the oid lists) we cannot set the bat tkey.
Date: 2015-05-20 22:06:55 +0200
somehow the combination of the extend (group by result for distinct) and
indeed some more fixing needed.
Date: 2015-11-25 22:34:05 +0100
Is this one fixed in the latest release?
Date: 2016-01-18 11:42:47 +0100
Martin: not yet in Jul2015 SP2
Date: 2016-04-17 10:07:32 +0200
For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=3fa0a17123c9
Date: 2016-04-17 10:08:23 +0200
We now generate a setKey when we know the result of the distinct (in this case) is unique (ie a single column result). Then the key info is propagated solving the rest of the problems.
The text was updated successfully, but these errors were encountered: