DROP SCALEOUT TABLE
Use DROP SCALEOUT TABLE to remove a scaleout table from the routing layer of a database cluster group for Aurora.
Description and syntax
Removes one scaleout table. Its member tables, rows, data mappings, collocations, and routing function stay.
DROP SCALEOUT TABLEtable_name;
Parameters and options
The statement takes the following parameters and options.
table_name-
The scaleout table, by the name that you created it with. One statement drops one scaleout table.
Where it runs and required privileges
Run the statement at the routing endpoint, in a session that isn't pinned, outside a transaction. For the details, see Where these statements run.
The router user needs dbclustergroup_metadata_admin or dbclustergroup_super_admin. For all privileges for database cluster groups for Aurora, see Privileges.
Usage notes
Keep the following in mind when you use the statement.
-
Drop the tables that use this one with
OFfirst. -
The statement removes only the scaleout table. To remove the routing function, data mappings, and member tables, follow the reverse of the order of creation: drop the routing function, delete the data mappings, and drop the member tables on their member clusters.
-
Save the table's
SHOW CREATE SCALEOUT TABLEoutput first. You can't read back a dropped scaleout table.
Examples
The following example drops a child table, then its parent, then their routing function.
DROP SCALEOUT TABLE items; DROP SCALEOUT TABLE orders; DROP SCALEOUT ROUTING FUNCTION orders_mod_fn;
Errors
The statement can return the following errors. For all errors from the routing layer, see Error codes for database cluster groups for Aurora.
| Aurora MySQL | Meaning |
|---|---|
1235 failed to remove table(s) <name>: cannot drop scaleout table '<name>': other scaleout tables inherit its routing function |
Other tables were created OF this one. Drop or switch them first. |
64001 Scaleout table '<name>' doesn't exist |
No scaleout table has that name. Include IF EXISTS to succeed when the table doesn't exist. |
| 1064 | Syntax error: a form outside the grammar, such as a list of tables in one statement. |
1227 Access denied; you need the '<PRIVILEGE>' privilege for this operation |
The router user lacks the privilege for database cluster groups for Aurora. |
If you include IF EXISTS and no scaleout table has the name, the statement succeeds and returns no error or warning.
Related statements
For more information, see the following: