Interface QueryQueue

All Known Implementing Classes:
DistributedQueryQueue, EmbeddedQueryQueue

public interface QueryQueue
Interface which defines a queue implementation for query queues. Implementations can queue locally, queue distributed, or do nothing at all.

A queue can report itself as enabled or disabled. When enabled, all queries must obtain a lease prior to starting execution. The lease must be released at the completion of execution.

  • Method Details

    • setMemoryPerNode

      void setMemoryPerNode(long memoryPerNode)
    • defaultQueryMemoryPerNode

      long defaultQueryMemoryPerNode(double cost)
      Return the amount of memory per node when creating a EXPLAIN query plan. Plans to be executed should get the query memory from the lease, as the lease may adjust the default amount on a per-query basis. This means that the memory used to execute the query may differ from the amount shown in an EXPLAIN plan.
      Returns:
      assumed memory per node, in bytes, to use when creating an EXPLAIN plan
    • minimumOperatorMemory

      long minimumOperatorMemory()
      Optional floor on the amount of memory assigned per operator. This ensures that operators receive a certain amount, separate from any memory slicing. This can oversubscribe node memory if used incorrectly.
      Returns:
      minimum per-operator memory, in bytes
    • enabled

      boolean enabled()
      Determine if the queue is enabled.
      Returns:
      true if the query is enabled, false otherwise.
    • enqueue

      Queue a query. The method returns only when the query is admitted for execution. As a result, the calling thread may block up to the configured wait time.
      Parameters:
      queryId - the query ID
      cost - the cost of the query used for cost-based queueing
      Returns:
      the query lease which must be passed to #release(QueueLease) upon query completion
      Throws:
      QueryQueue.QueueTimeoutException - if the query times out waiting to be admitted.
      QueryQueue.QueryQueueException - for any other error condition.
    • close

      void close()