org.apache.ignite.events

## Class SqlQueryExecutionEvent

- java.lang.Object
- - org.apache.ignite.events.EventAdapter
  - - org.apache.ignite.events.SqlQueryExecutionEvent

- All Implemented Interfaces:
    Serializable, Comparable<Event>, Event

      public class SqlQueryExecutionEvent
      extends EventAdapter

  Query execution event. This event is triggered after a corresponding SQL query validated and before it is executed. Unlike `EventType.EVT_CACHE_QUERY_EXECUTED`, `EventType.EVT_SQL_QUERY_EXECUTION` is fired only once for a request and does not relate to a specific cache.

  Grid events are used for notification about what happens within the grid. Note that by design Ignite keeps all events generated on the local node locally and it provides APIs for performing a distributed queries across multiple nodes:

  - `IgniteEvents.remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)` - asynchronously querying events occurred on the nodes specified, including remote nodes.
  - `IgniteEvents.localQuery(org.apache.ignite.lang.IgnitePredicate, int...)` - querying only local events stored on this local node.
  - `IgniteEvents.localListen(org.apache.ignite.lang.IgnitePredicate, int...)` - listening to local grid events (events from remote nodes not included).
  User can also wait for events using method `IgniteEvents.waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)`.

  # Events and Performance

  Note that by default all events in Ignite are enabled and therefore generated and stored by whatever event storage SPI is configured. Ignite can and often does generate thousands events per seconds under the load and therefore it creates a significant additional load on the system. If these events are not needed by the application this load is unnecessary and leads to significant performance degradation.

  It is highly recommended to enable only those events that your application logic requires by using `IgniteConfiguration.getIncludeEventTypes()` method in Ignite configuration. Note that certain events are required for Ignite's internal operations and such events will still be generated but not stored by event storage SPI if they are disabled in Ignite configuration.

  See Also:
    `EventType.EVT_SQL_QUERY_EXECUTION`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SqlQueryExecutionEvent(ClusterNode node, String msg, @Nullable String text, @Nullable Object[] args, @Nullable UUID subjId)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `@Nullable Object[]` | `arguments()` Gets query arguments.
    `@Nullable UUID` | `subjectId()` Gets security subject ID.
    `@Nullable String` | `text()` Gets query text.
    `String` | `toString()`

    - ### Methods inherited from class org.apache.ignite.events.EventAdapter

      `compareTo, equals, hashCode, id, localOrder, message, message, name, node, node, shortDisplay, timestamp, type, type`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SqlQueryExecutionEvent

          public SqlQueryExecutionEvent(ClusterNode node,
                                        String msg,
                                        @Nullable
                                        @Nullable String text,
                                        @Nullable
                                        @Nullable Object[] args,
                                        @Nullable
                                        @Nullable UUID subjId)

      Parameters:
        `node` - Node where event was fired.
        `msg` - Event message.
        `text` - Query text.
        `args` - Query arguments.
        `subjId` - Security subject ID.

  - ### Method Detail

    - #### text

          @Nullable
          public @Nullable String text()

      Gets query text.

      Applicable for `SQL`, `SQL fields` queries.

      Returns:
        Query text.

    - #### arguments

          @Nullable
          public @Nullable Object[] arguments()

      Gets query arguments.

      Applicable for `SQL` and `SQL fields` queries.

      Returns:
        Query arguments.

    - #### subjectId

          @Nullable
          public @Nullable UUID subjectId()

      Gets security subject ID.
      Returns:
        Security subject ID.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `EventAdapter`

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023