Skip to content

Commit

Permalink
[Doc]Document all the currently supported SQL operation for memory co…
Browse files Browse the repository at this point in the history
…nnector
  • Loading branch information
Akanksha-kedia authored and steveburnett committed Mar 26, 2024
1 parent 333cb04 commit 59bd301
Showing 1 changed file with 74 additions and 17 deletions.
91 changes: 74 additions & 17 deletions presto-docs/src/main/sphinx/connector/memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------

Expand Down Expand Up @@ -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.

0 comments on commit 59bd301

Please sign in to comment.