Explore Spider functions in MariaDB Server. Learn about the specialized functions that enhance data access and manipulation across sharded and distributed databases using the Spider storage engine.
Learn how to use this function to copy table data from one Spider link ID to another, useful for migrating data or rebalancing shards without stopping the service.
SPIDER_COPY_TABLES(spider_table_name,
source_link_id, destination_link_id_list [,parameters])A UDF installed with the Spider Storage Engine, this function copies table data from source_link_id to destination_link_id_list. The service does not need to be stopped in order to copy.
If the Spider table is partitioned, the name must be of the format table_name#P#partition_name. The partition name can be viewed in the mysql.spider_tables table, for example:
Returns 1 if the data was copied successfully, or 0 if copying the data failed.
This page is licensed: CC BY-SA / Gnu FDL
This UDF allows you to execute SQL statements on remote data nodes in the background, enabling concurrent processing and non-blocking operations.
Executes the given SQL statement in the background on the remote server, as defined in the parameters listing. If the query returns a result-set, it sttores the results in the given temporary table. When the given SQL statement executes successfully, this function returns the number of called UDF's. It returns 0 when the given SQL statement fails.
This function is a installed with the storage engine.
error_rw_modeDescription: Returns empty results on network error.
0 : Return error on getting network error.
1: Return 0 records on getting network error.
This page is licensed: CC BY-SA / Gnu FDL
Use this UDF to refresh the cache used by Spider's monitoring threads, ensuring that the status of remote tables and connections is up to date.
SPIDER_FLUSH_TABLE_MON_CACHE()A UDF installed with the Spider Storage Engine, this function is used for refreshing monitoring server information. It returns a value of 1.
This page is licensed: CC BY-SA / Gnu FDL
SPIDER_BG_DIRECT_SQL('sql', 'tmp_table_list', 'parameters')0DSN Parameter Name: erwm
SELECT table_name FROM mysql.spider_tables;
+-------------+
| table_name |
+-------------+
| spt_a#P#pt1 |
| spt_a#P#pt2 |
| spt_a#P#pt3 |
+-------------+SELECT SPIDER_FLUSH_TABLE_MON_CACHE();
+--------------------------------+
| SPIDER_FLUSH_TABLE_MON_CACHE() |
+--------------------------------+
| 1 |
+--------------------------------+This function executes an SQL string directly on a specified remote backend server, allowing for maintenance tasks or queries that bypass local parsing.
SPIDER_DIRECT_SQL('sql', 'tmp_table_list', 'parameters')A UDF installed with the Spider Storage Engine, this function is used to execute the SQL string sql on the remote server, as defined in parameters. If any resultsets are returned, they are stored in the tmp_table_list.
The function returns 1 if the SQL executes successfully, or 0 if it fails.
This page is licensed: CC BY-SA / Gnu FDL
SELECT SPIDER_BG_DIRECT_SQL('SELECT * FROM example_table', '',
'srv "node1", port "8607"') AS "Direct Query";
+--------------+
| Direct Query |
+--------------+
| 1 |
+--------------+SELECT SPIDER_DIRECT_SQL('SELECT * FROM s', '', 'srv "node1", port "8607"');
+----------------------------------------------------------------------+
| SPIDER_DIRECT_SQL('SELECT * FROM s', '', 'srv "node1", port "8607"') |
+----------------------------------------------------------------------+
| 1 |
+----------------------------------------------------------------------+