How to clear cache in Drupal 10 Using SQL Queries – Beginner Friendly Guide

Sometimes in Drupal, changes you make on your website may not appear immediately. This happens because Drupal stores data in cache to make the site faster.

If your changes are not showing, you need clearing cache using SQL queries Drupal. This is especially useful if you are a developer or working on a local/test site and want to fix cache problems quickly.

While you can clear cache using Drupal admin or Drush, SQL queries can help you clear cache directly from the database, which is faster in some cases.

Why Cache Exists in Drupal

Drupal uses cache to:

  • Load pages faster
  • Reduce database queries
  • Improve website performance

Sometimes cache causes problems:

  • Changes in content or configuration do not appear
  • Custom module or theme changes are not reflected
  • Slow performance during development

In these cases, clearing cache using SQL queries Drupal is useful.

How to Clear Cache Using SQL Queries

Always backup your database before running SQL queries.

Drupal cache is stored in database tables starting with cache_. Common tables are:

  • cache_config – configuration cache
  • cache_data – custom module cache
  • cache_render – rendered HTML
  • cache_bootstrap – bootstrap cache

To clear all cache, run these SQL queries:

sql

TRUNCATE cache_config;
TRUNCATE cache_data;
TRUNCATE cache_render;
TRUNCATE cache_bootstrap;

This will empty all cache tables, and Drupal will rebuild the cache automatically.

Clearing Specific Cache Tables

If you want to clear only one type of cache, for example the render cache:

TRUNCATE cache_render;

This is safer than clearing everything and faster during development.

Important Tips

  • Always backup the database before truncating tables
  • Avoid running SQL queries on live production sites; use Drush instead
  • After clearing cache, Drupal will rebuild cache automatically
  • Use this method mainly in development or test environments

Key Takeaways

  • Drupal cache is stored in cache_ tables
  • You can clear cache using SQL queries with the TRUNCATE command
  • Best used in development or staging
  • Drush or admin UI is safer for production sites

Conclusion

Clearing cache using SQL queries Drupal is a simple and fast way to fix cache issues during development. By understanding cache tables and using these queries safely, even a beginner can manage Drupal cache efficiently.