<<<<<<< HEAD memory_used | H2 | SQLDoc
Skip to main content

memory_used

1. MEMORY_USED Function

======= memory_used | H2 Function | SQLDoc

memory_used

1. MEMORY_USED Function

>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62be

The MEMORY_USED function in H2 database is used to retrieve the amount of memory currently used by the database.

2. Syntax

The syntax for the MEMORY_USED function in H2 database is as follows:

MEMORY_USED()

Arguments

  • None. The MEMORY_USED function does not require any arguments.

Return

  • The MEMORY_USED function returns the amount of memory used by the database in bytes.

3. Notes

  • The MEMORY_USED function provides information about the memory usage of the H2 database at the moment the function is called.
  • The value returned by the MEMORY_USED function represents the memory usage in bytes.
  • This function can be useful for monitoring and optimizing memory consumption in the H2 database.

4. Examples

Here are a few examples demonstrating the usage of the MEMORY_USED function in H2 database:

Example 1 - Retrieving the current memory usage:

SELECT MEMORY_USED() AS memory_used;

Output:

memory_used
-----------
12415104

Example 2 - Using the MEMORY_USED function in a query:

SELECT id, name
FROM users
WHERE MEMORY_USED() < 10000000;

Output:

id | name
---+-----
1 | John
2 | Alice
3 | Bob
  • memory_free - Calculate the amount of free memory available in the database.