Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6890

query cache, only invalidate when table change

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None
    • Query Cache
    • None

    Description

      hi guys... well again query cache...

      check this...

      create table ae(b enum('a','b','c') not null);
      insert into ae values ('a'),('b'),('c');
      select * from information_schema.QUERY_CACHE_QUERIES; /* no query, nice */
       
      select * from ae;
      select * from information_schema.QUERY_CACHE_QUERIES; /* one query, nice too */
       
      update ae set b='d' where b='d'; /* no row changed */
       
      select * from information_schema.QUERY_CACHE_QUERIES; /* no queries ?! */

      i didn't checked how each engine remove queries from query cache, but... should it only remove queries from query cache, if one+ row(s) change? this reduce table invalidation, increase query cache hit

      idea of this MDEV: create a 'delayed' query cache invalidation, in other words, instead of invalidating when one UPDATE/DELETE/INSERT occur, only invalidate if one row changed, ok this is a problem with transactions where we don't know if it should or not be invalidated outside transaction, but, if update/delete don't change anything, why should it invalidate query cache?


      idea: instead of invalidating... first mark table to 'not allow new queries at query cache', after update/insert/delete, if row changed/affected>0 execute the invalidation, if <=0 'unlock' the table from query cache (allow new queries use this table), we will have some queries not cached cause we 'locked' insert into query cache using update/delete/insert table , but this increase query cache hit, and allow a lower resource consume invalidating always queries without rows changed

      Attachments

        Activity

          People

            Unassigned Unassigned
            rspadim roberto spadim
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.