Class QueryOptimiserContext


  • public class QueryOptimiserContext
    extends java.lang.Object
    A class describing settings for the optimiser. One should create an instance of this class, alter the settings to suit, and pass it in to the optimise methods.
    Author:
    Matthew Wakeling
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static QueryOptimiserContext DEFAULT
      The default context - normal operation with no time limit.
      static java.lang.String MODE_NORMAL
      Normal operation - no logging
      static java.lang.String MODE_VERBOSE
      Normal operation, plus logging to stdout
      static java.lang.String MODE_VERBOSE_LIST
      Logs all generated queries to the stdout, without explaining
      static java.lang.String MODE_VERBOSE_SUMMARY
      Summarises all generated queries to the stdout, without explaining
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getMaxQueryParseTime()
      Get the maximum time in milliseconds that the optimiser should spend parsing a query from SQL string to an org.intermine.sql.Query object.
      java.lang.String getMode()
      Returns the optimiser mode of operation.
      long getTimeLimit()
      Returns the time limit.
      boolean isVerbose()
      Returns true if the optimiser will print out stuff.
      void setMaxQueryParseTime​(long maxQueryParseTime)
      Set the maximum time in milliseconds that the optimiser should spend parsing a query from SQL string to an org.intermine.sql.Query object.
      void setMode​(java.lang.String mode)
      Sets the optimiser mode of operation.
      void setTimeLimit​(long timeLimit)
      Sets the optimiser's maximum effort time, in milliseconds.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MODE_NORMAL

        public static final java.lang.String MODE_NORMAL
        Normal operation - no logging
        See Also:
        Constant Field Values
      • MODE_VERBOSE

        public static final java.lang.String MODE_VERBOSE
        Normal operation, plus logging to stdout
        See Also:
        Constant Field Values
      • MODE_VERBOSE_LIST

        public static final java.lang.String MODE_VERBOSE_LIST
        Logs all generated queries to the stdout, without explaining
        See Also:
        Constant Field Values
      • MODE_VERBOSE_SUMMARY

        public static final java.lang.String MODE_VERBOSE_SUMMARY
        Summarises all generated queries to the stdout, without explaining
        See Also:
        Constant Field Values
      • DEFAULT

        public static final QueryOptimiserContext DEFAULT
        The default context - normal operation with no time limit.
    • Constructor Detail

      • QueryOptimiserContext

        public QueryOptimiserContext()
    • Method Detail

      • setMode

        public void setMode​(java.lang.String mode)
        Sets the optimiser mode of operation.
        Parameters:
        mode - MODE_NORMAL, MODE_VERBOSE, MODE_VERBOSE_LIST, or MODE_VERBOSE_SUMMARY
      • getMode

        public java.lang.String getMode()
        Returns the optimiser mode of operation.
        Returns:
        mode
      • setTimeLimit

        public void setTimeLimit​(long timeLimit)
        Sets the optimiser's maximum effort time, in milliseconds. The optimiser will cease optimising the query if it notices that it has spent longer than this number of milliseconds. Note that this value is not a deadline - it will not be kept. The optimiser can take as much as the time taken to explain a query more than this value. A value of -1 indicates that there is no limit. A value of zero will result in only one query being explained - this may or may not be the original query.
        Parameters:
        timeLimit - time in milliseconds
      • getTimeLimit

        public long getTimeLimit()
        Returns the time limit.
        Returns:
        time limit
      • isVerbose

        public boolean isVerbose()
        Returns true if the optimiser will print out stuff.
        Returns:
        a boolean
      • getMaxQueryParseTime

        public long getMaxQueryParseTime()
        Get the maximum time in milliseconds that the optimiser should spend parsing a query from SQL string to an org.intermine.sql.Query object.
        Returns:
        the max query parse time
      • setMaxQueryParseTime

        public void setMaxQueryParseTime​(long maxQueryParseTime)
        Set the maximum time in milliseconds that the optimiser should spend parsing a query from SQL string to an org.intermine.sql.Query object.
        Parameters:
        maxQueryParseTime - the max query parse time