Hi!
2) ... where 'expr' [>=, >, =, <=, <] 'some-value' => ... where ('expr' [>=, >, =, <=, <] 'some-value') and ('vfield' [>=, >, =, <=, <] 'some-value').
What about `where expr`, `where expr in expr` and whatnot?
My first approach was to try to generalize all rewrite rules, but now I am totally confused about what rules to implement next week.
I think your first approach was correct: just write a general substitution algorithm. The exclusion rules could be added later, on demand.
Now I have failing tests gcol.gcol_keys_innodb gcol.gcol_keys_myisam. I will further research how my changes broke them.
The optimizer is controlled by a set of switches -- try to add your own switch and turn it off by default! You can turn it on only for your test with SET command, like for most other system variables (don't forget to turn it off after test) Later it could be considered to be turned on by default, and turned off for those two tests only (if that's not a bug ofc). This will also partially solve the question about additional exclusion rules. The general algorithm should always work correct, and not worse than with no substitution (at least asymptotically). The User will have possibility to turn it off for particular queries, if it's that dramatical for the one. On Tue, 11 Jun 2019 at 00:38, Alexey Mogilyovkin <zeroicq@gmail.com> wrote:
Week 2 report. This week was more productive than previous. I put aside complex expressions, subselection, unions etc. Took into account the comments about bad iterators usage and tried to fix it. I've also implemented two simple rewrite rules. 1) ... where 'expr' => ...where 'vfield'. 2) ... where 'expr' [>=, >, =, <=, <] 'some-value' => ... where ('expr' [>=, >, =, <=, <] 'some-value') and ('vfield' [>=, >, =, <=, <] 'some-value').
I am really not sure if rule №1 will somehow help optimizer. Probably it is useless. For the rule №2 I wrote test. Now I have failing tests gcol.gcol_keys_innodb gcol.gcol_keys_myisam. I will further research how my changes broke them. Also I've encountered strange error in travis-ci. Have no idea how to fix it. The command "env DEB_BUILD_OPTIONS="parallel=4" debian/autobake-deb.sh;" exited with 2. https://travis-ci.org/ZeroICQ/server/jobs/543019254
Initially I put my code into sql_parse, but now I think that a better approach will be to put it somewhere in optimizer.
From messages in zulip I understood that some rewrites could not be used by the optimizer. My first approach was to try to generalize all rewrite rules, but now I am totally confused about what rules to implement next week. Diff can be found here https://github.com/MariaDB/server/compare/10.4...ZeroICQ:MDEV-6017
-- Yours truly, Nikita Malyavin