From 59bd30154c40a31ac1b309cdfac2133f6ef93780 Mon Sep 17 00:00:00 2001 From: "kedia,Akanksha" Date: Wed, 20 Mar 2024 12:27:42 +0530 Subject: [PATCH] [Doc]Document all the currently supported SQL operation for memory connector --- .../src/main/sphinx/connector/memory.rst | 91 +++++++++++++++---- 1 file changed, 74 insertions(+), 17 deletions(-) diff --git a/presto-docs/src/main/sphinx/connector/memory.rst b/presto-docs/src/main/sphinx/connector/memory.rst index 45ffbaef87ec..0a49cc4a6290 100644 --- a/presto-docs/src/main/sphinx/connector/memory.rst +++ b/presto-docs/src/main/sphinx/connector/memory.rst @@ -5,7 +5,6 @@ Memory Connector The Memory connector stores all data and metadata in RAM on workers and both are discarded when Presto restarts. - Configuration ------------- @@ -41,23 +40,81 @@ Drop table:: DROP TABLE memory.default.nation; +SQL Support +----------- + +The Memory connector allows querying and creating tables and schemas in memory. Here are some examples of the SQL operations supported: + +CREATE SCHEMA +^^^^^^^^^^^^^ + +Create a new schema named ``default1``: + +.. code-block:: sql + + CREATE SCHEMA memory.default1; + +CREATE TABLE +^^^^^^^^^^^^ + +Create a new table named ``my_table`` in the ``default1`` schema: + +.. code-block:: sql + + CREATE TABLE memory.default1.my_table (id integer, name varchar, age integer); + +INSERT INTO +^^^^^^^^^^^ + +Insert data into the ``my_table`` table: + +.. code-block:: sql + + INSERT INTO memory.default1.my_table (id, name, age) VALUES (1, 'John Doe', 30); + +SELECT +^^^^^^ + +Select data from the ``my_table`` table: + +.. code-block:: sql + + SELECT * FROM memory.default1.my_table; + +DROP TABLE +^^^^^^^^^^ + +To delete an existing table: + +.. code-block:: sql + + DROP TABLE memory.default.nation; + +.. note:: After using ``DROP TABLE``, memory is not released immediately. It is released after the next write access to the memory connector. Memory Connector Limitations ---------------------------- - * After ``DROP TABLE`` memory is not released immediately. It is - released after next write access to memory connector. - * When one worker fails/restarts all data that were stored in its - memory will be lost forever. To prevent silent data loss this - connector will throw an error on any read access to such - corrupted table. - * When query fails for any reason during writing to memory table, - table will be in undefined state. Such table should be dropped - and recreated manually. Reading attempt from such table may fail - or may return partial data. - * When coordinator fails/restarts all metadata about tables will - be lost, but tables' data will be still present on the workers - however they will be inaccessible. - * This connector will not work properly with multiple - coordinators, since each coordinator will have a different - metadata. +The following SQL statements are not supported: + +* :doc:`/sql/alter-table` +* :doc:`/sql/delete` +* :doc:`/sql/update` + +Limitations +^^^^^^^^^^^ + +* When one worker fails or restarts, all data stored in its + memory is lost forever. To prevent silent data loss, this + connector generates an error on any read access to such a + corrupted table. +* When a query fails for any reason during writing to memory table, + the table is in undefined state. Such a table should be dropped + and recreated manually. Reading from such tables may fail + or may return partial data. +* When the coordinator fails or restarts, all metadata about tables is + lost. The tables' data is still present on the workers, + but that data is inaccessible. +* This connector will not work properly with multiple + coordinators, because each coordinator has a different + metadata.