Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • MariaDB Cookbook
  • Toc
  • feedback
MariaDB Cookbook

MariaDB Cookbook

By : Daniel Bartholomew
4.2 (9)
close
MariaDB Cookbook

MariaDB Cookbook

4.2 (9)
By: Daniel Bartholomew

Overview of this book

Table of Contents (20 chapters)
close
MariaDB Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Optimizing queries with the subquery cache


The subquery cache is one of the several methods utilized by MariaDB to improve the performance of statements with subqueries. This is a feature unique to MariaDB and makes subqueries in MariaDB much faster than competing databases.

Getting ready

Import the ISFDB database as described in the Importing the data exported by mysqldump recipe in Chapter 2, Diving Deep into MariaDB.

How to do it...

  1. Restart MariaDB to clear the subquery cache.

  2. Launch the mysql command-line client application and connect to the isfdb database on our MariaDB server.

  3. Run the following command to show our usage of the subquery cache:

    SHOW STATUS LIKE 'subquery%';
    
  4. Because we just restarted MariaDB and cleared the subquery cache, the output will look like the following screenshot:

  5. Run the following query:

    SELECT titles.title_id AS ID, 
      titles.title_title AS Title, 
      authors.author_legalname AS Name, 
      (SELECT COUNT(DISTINCT title_relationships.review_id) 
        FROM title_relationships...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete