Common SQL Errors

MySQL Error 3060 ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS - How to Fix and Prevent

Galaxy Team
August 8, 2025

The ALTER TABLE statement cannot run online when the table contains a spatial (GIS) index.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error code 3060?

ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS occurs when MySQL rejects an online ALTER TABLE on a table that has a spatial (GIS) index. Remove ALGORITHM=INPLACE, drop and recreate the GIS index, or use a copy-based alteration to resolve the problem.

Error Highlights

Typical Error Message

ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS

Error Type

DDL Operation Error

Language

MySQL

Symbol

ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS was added in 5.7.5.

Error Code

3060

SQL State

HY000

Explanation

Table of Contents

What is MySQL error 3060 ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS?

Error 3060 is raised when you attempt an online or in-place ALTER TABLE on a table that contains a GIS (spatial) index. MySQL versions 5.7.5 and later restrict certain online DDL operations for spatial indexes because the storage engine cannot update the index concurrently with row changes.

The server returns SQLSTATE HY000 with the message "Do not support online operation on table with GIS index" and cancels the ALTER statement. Understanding the limitation helps you choose the correct alteration method and avoid unexpected downtime.

What Causes This Error?

The primary trigger is specifying ALGORITHM=INPLACE or ALGORITHM=ONLINE implicitly or explicitly in an ALTER TABLE statement on a table that already has an SPATIAL KEY. MySQL detects the spatial index and blocks the online path to protect data integrity.

Other contributing factors include using pt-online-schema-change or gh-ost, which internally request online DDL, and running on MySQL 5.7 or early 8.0 releases where spatial online DDL is not yet implemented.

How to Fix ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS

The quickest fix is to let MySQL use the copy algorithm: omit the ALGORITHM clause or set ALGORITHM=COPY. The server will create a temporary table, copy data, and swap tables, avoiding the unsupported online path.

If downtime must be minimal, drop the spatial index, perform the online ALTER, and then add the index back. This creates two short blocking windows instead of a full copy.

Common Scenarios and Solutions

Adding a non-indexed column: run ALTER TABLE t ADD COLUMN col INT, ALGORITHM=COPY; or drop the SPATIAL KEY, run an online add column, and recreate the index.

Changing column type referenced by the spatial index: always plan for a full copy or recreate the table because the index must be rebuilt offline.

Best Practices to Avoid This Error

Check INFORMATION_SCHEMA.STATISTICS for SPATIAL index types before scheduling online DDL. Automate this check in deployment scripts.

Upgrade to the latest MySQL 8.0 where more operations are supported online, though spatial index changes still require copy in many cases.

Related Errors and Solutions

Error 1846 (ER_ALTER_OPERATION_NOT_SUPPORTED): General unsupported online DDL. Remove INPLACE or use COPY.

Error 1848 (ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME): Rename blocked by foreign keys. Disable keys or copy.

Common Causes

Unsupported Online Algorithm

Using ALGORITHM=INPLACE or the default online algorithm on a table that owns a spatial index triggers error 3060.

Spatial Index Present

Any SPATIAL KEY defined on geometry, point, or polygon columns blocks online alteration because the index cannot be updated concurrently.

Tool-Generated Online DDL

Migrations executed by pt-online-schema-change or gh-ost silently request online DDL, surfacing the error when spatial indexes exist.

Related Errors

ER_ALTER_OPERATION_NOT_SUPPORTED (1846)

Generic message for any unsupported online operation. Similar resolution: switch to COPY.

ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME (1848)

Raised when renaming a column referenced by a foreign key in online mode. Drop constraint or use COPY.

ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL (1847)

Occurs when changing nullability online. Requires COPY algorithm or staged updates.

FAQs

What is a GIS index in MySQL?

A GIS index is a spatial index on geometry data types that accelerates location queries using R-Trees.

Is the error fixed in MySQL 8.0?

MySQL 8.0 adds more online DDL support, but many spatial index changes still require the copy algorithm.

Can I force the ALTER to proceed online?

No. MySQL will always block unsupported online alterations involving spatial indexes to protect data integrity.

How does Galaxy help?

Galaxy flags tables with spatial indexes during schema introspection, warns you before running online DDL, and suggests the correct algorithm, preventing error 3060.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo