Search code examples
monetdb

Something about the optimizer


  1. I create a database and connect with it. But when I execute
select optimizer;

it returns

SELECT: identifier 'optimizer' unknown

What's the problem with it? And I can't find the sys table in the database using \d.

  1. If I want to add an optimizer myopt, is it enough for the steps below:
    1. write the opt_myopt.h and opt_myopt.c in /monetdb5/optimizer/
    2. Add the code into codes in /monetdb5/optimizer/opt_wrapper.c
    3. Add the function into optimizer_init_funcs in /monetdb5/optimizer/optimizer.c
    4. Add a new pipe in /monetdb5/optimizer/opt_pipes.c

Solution

  • For your first question: if your current_schema is not sys, you need to use select sys.optimizer;.

    For your second question: the best existing example is probably in monetdb5/extras/mal_optimizer_template. Next to that, it's basically checking the source code to see how other optimisers have been implemented. NB, although it doesn't often happen, the internals of MonetDB can change between (major) versions. I'd recomment you to use Oct2020 or newer.