1. 24 Aug, 2023 1 commit
    • Rex's avatar
      MDEV-31431 support sql standard <explicit table> expressions · d1023d64
      Rex authored
      Initial support for sql standard <explicit table> expressions
      The <explicit table>
          TABLE <table or query name>
          is equivalent to the <query specification>
          SELECT * FROM <table or query name>
      Deal with the conflict caused by ANALYZE TABLE t1; being both
      a request for table statistics and analyzing an SQL statement.
      d1023d64
  2. 07 Jun, 2023 3 commits
    • Monty's avatar
      MDEV-30944 Range_rowid_filter::fill() leaves file->keyread at MAX_KEY · ded4ed32
      Monty authored
      This test case exposed 2 different bugs:
      - When replacing a range with an index scan on a covering key
        in test_if_skip_sort_order() we didn't disable filtering.
        Filtering does not make much sense in this case.
        - Fixed by disabling filtering in this case.
      - Range_rowid_filter::fill() did not take into account that keyread
        could already active, which caused an assert when it tried to
        activate another keyread.
        - Fixed by remembering old keyread state at start and restoring it
          at end.
      
      Other things:
      - ha_start_keyread() allowed multiple calls. This is wrong, especially
        as we do no check if the index changed!
        I added an assert() to ensure that we don't call it there is already
        an active keyread.
      - ha_end_keyread() always called ha_extra(), even if keyread was not
        active.  Added a check to avoid the extra call.
      ded4ed32
    • Monty's avatar
      3ea8f306
    • Monty's avatar
      MDEV-31356: Range cost calculations does not take into account join_buffer · 07b02ab4
      Monty authored
      This patch also fixes
      MDEV-31391 Assertion `((best.records_out) == 0.0 ... failed
      
      Cost changes caused by this change:
      - range queries with join buffer now have a notable smaller cost.
      - range ranges are bit more expensive as the MULTI_RANGE_COST is now
        properly applied to it in all cases (this extra cost is equal to a
        key lookup).
      - table scan cost is slight smaller as we now assume data is cached in
        the engine after the first scan pass. (We did this before for range
        scans and other access methods).
      - partition tables had wrong values for max_row_blocks and
        max_index_blocks.  Correcting this, causes range access on
        partitioned tables to have slightly higher cost because of the
        increased estimated IO.
      - Using first match + join buffer caused 'filtered' to be calcualted
        wrong.  (Only affected EXPLAIN, not query costs).
      - Added cost_without_join_buffer to optimizer_trace.
      - check_quick_select() adjusted the number of rows according to persistent
        statistics, but did not adjust cost. Now fixed.
      
      The big change in the patch are:
      
      - In best_access_path(), where we now are using storing the cost in
        'ALL_READ_COST cost' and only converting it to a double at the end.
         This allows us to more exactly calculate the effect of the join_cache.
      - In JOIN_TAB::estimate_scan_time(), store the cost also in a
        ALL_READ_COST object.
      
      One of effect if this change is that when joining very small tables:
      
      t1    some_access_method
      t2    range
      t3    ALL         Use join buffer
      
      This is swiched to
      
      t1      some_access_method
      t3      ALL
      t2      range      use join buffer
      
      Both plans has the same cost, but as table scan in this case has less
      cost than rang, the table scan will be considered first and thus have
      precidence.
      
      Test case changes:
      - optimizer_trace          - Addition of cost_without_join_buffer
      - subselect_mat_cost_bugs  - Small tables and scan versus range
      - range & range_mrr_icp    - Range + join_cache is faster than ref
      - optimizer_trace          - cost_without_join_buffer, smaller scan cost,
                                   range setup cost.
      - mrr                      - range+join_buffer used as smaller cost
      07b02ab4
  3. 06 Jun, 2023 1 commit
  4. 03 Jun, 2023 2 commits
  5. 27 May, 2023 3 commits
  6. 09 May, 2023 2 commits
    • Sergei Petrunia's avatar
      MDEV-31223: UBSan error: sql_select.h:969:7: runtime error: load of value... · 368dd22a
      Sergei Petrunia authored
      In Loose_scan_opt::save_to_position, initialize
      POSITION::firstmatch_with_join_buf.
      368dd22a
    • Sergei Petrunia's avatar
      MDEV-31022: SIGSEGV in maria_create from create_internal_tmp_table · b3edbf25
      Sergei Petrunia authored
      The code in create_internal_tmp_table() didn't take into account that
      now temporary (derived) tables may have multiple indexes:
      
      - one index due to duplicate removal
         = In this example created by conversion of big-IN(...) into subquery
         = this index might be converted into a "unique constraint" if the key
           length is too large.
      - one index added by derived_with_keys optimization.
      
      Make create_internal_tmp_table() handle multiple indexes.
      
      Before this patch, use of a unique constraint was indicated in
      TABLE_SHARE::uniques. This was ok as unique constraint was the only index
      in the table. Now it's no longer the case so TABLE_SHARE::uniques is removed
      and replaced with an in-memory-only flag HA_UNIQUE_HASH.
      
      This patch is based on Monty's patch.
      Co-Author: Monty <monty@mariadb.org>
      b3edbf25
  7. 03 May, 2023 5 commits
    • Monty's avatar
      63df43a0
    • Monty's avatar
      Moved events tests from main to suite/events · 78f684e5
      Monty authored
      This makes it easier to run test on just events.
      78f684e5
    • Monty's avatar
      Moved merge tests from main to suite/merge · ec820a38
      Monty authored
      This makes it easier to run test on just the MRG_MYISAM engine.
      
      Other things:
      - Renamed merge-big.test to flush_corruption.test as it does not
        have anything to do with merge tables.
      ec820a38
    • Monty's avatar
      MDEV-30786 SIGFPE in cost_group_min_max on EXP · 0099c2fc
      Monty authored
      The problem was that for merge tables without any underlaying tables the
      block size was 0, which the code could not handle.
      
      Fixed by ensuring that MERGE tables never have a block size of 0.
      Fixed also a wrong assumption of number of seeks needed to scan
      merge tables.
      0099c2fc
    • Monty's avatar
      MDEV-30812: Improve output cardinality estimates for hash join · 3bdc5542
      Monty authored
      Introduces @@optimizer_switch flag: hash_join_cardinality
      
      When this option is on, use EITS statistics to produce tighter bounds
      for hash join output cardinality.
      
      This patch is an extension / replacement to a similar patch in 10.6
      
      New features:
      - optimizer_switch hash_join_cardinality is on by default
      - records_out is set to fanout when HASH is used
      - Fixed bug in is_eits_usable: The function did not work with views
      3bdc5542
  8. 28 Apr, 2023 6 commits
  9. 27 Apr, 2023 13 commits
  10. 26 Apr, 2023 4 commits