C++ Client API Reference for Oracle Coherence
14c (14.1.2.0.0)

F79659-03

coherence/util/QueryRecord.hpp

00001 /*
00002  * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
00003  *
00004  * Licensed under the Universal Permissive License v 1.0 as shown at
00005  * http://oss.oracle.com/licenses/upl.
00006  */
00007 #ifndef COH_QUERY_RECORD_HPP
00008 #define COH_QUERY_RECORD_HPP
00009 
00010 #include "coherence/lang.ns"
00011 
00012 #include "coherence/net/partition/PartitionSet.hpp"
00013 #include "coherence/util/List.hpp"
00014 #include "coherence/util/Map.hpp"
00015 #include "coherence/util/Set.hpp"
00016 #include "coherence/util/aggregator/QueryRecorder.hpp"
00017 
00018 COH_OPEN_NAMESPACE2(coherence,util)
00019 
00020 using coherence::net::partition::PartitionSet;
00021 using coherence::util::aggregator::QueryRecorder;
00022 
00023 /**
00024 * The QueryRecord object carries a record of the estimated or actual
00025 * execution cost for a query operation.
00026 *
00027 * @since Coherence 3.7.1
00028 *
00029 * @author tb 2011.05.26
00030 */
00031 class COH_EXPORT QueryRecord
00032     : public interface_spec<QueryRecord>
00033     {
00034     // ----- QueryRecord interface ------------------------------------------
00035 
00036     public:
00037         /**
00038         * Get the {@link RecordType type} that was specified when this query
00039         * record was created.
00040         *
00041         * @return the record type
00042         */
00043         virtual QueryRecorder::RecordType getType() const = 0;
00044 
00045         /**
00046         * Get the list of partial results for this query record.
00047         *
00048         * @return the list of results
00049         */
00050         virtual List::View getResults() const = 0;
00051 
00052         // ----- inner interface: PartialResult -------------------------
00053 
00054         /**
00055          * A QueryPlan.PartialResult is a partial query record that contains
00056          * recorded costs for a query operation.  Partial results are collected
00057          * in a query record by a {@link QueryRecorder}.
00058          */
00059         class COH_EXPORT PartialResult
00060             : public interface_spec<PartialResult>
00061             {
00062             public:
00063 
00064                 /**
00065                 * Get the list of steps for this query record partial result in the
00066                 * order that they occurred.
00067                 *
00068                 * @return the list of steps
00069                 */
00070                 virtual List::View getSteps() const = 0;
00071 
00072                 /**
00073                 * Get the set of partitions associated with this partial result.
00074                 *
00075                 * @return the partition set
00076                 */
00077                 virtual PartitionSet::Handle getPartitions() = 0;
00078 
00079                 /**
00080                 * Get the set of partitions associated with this partial result.
00081                 *
00082                 * @return the partition set
00083                 */
00084                 virtual PartitionSet::View getPartitions() const = 0;
00085 
00086                 // -----inner interface: Step ---------------------------
00087 
00088                 /**
00089                 * A QueryPlan.Step carries the recorded cost of evaluating a filter
00090                 * as part of a query operation.  This cost may be the estimated or
00091                 * actual execution cost depending on the
00092                 * {@link QueryRecorder.RecordType type} of the
00093                 * {@link QueryRecorder recorder} in use when the step was created.
00094                 */
00095                 class COH_EXPORT Step
00096                     : public interface_spec<Step>
00097                     {
00098                     public:
00099 
00100                         /**
00101                         * Get a description of the filter that was associated with this
00102                         * step during its creation.
00103                         *
00104                         * @return the description of the filter
00105                         */
00106                         virtual String::View getFilterDescription() const = 0;
00107 
00108                         /**
00109                         * Get the recorded information about the index lookups performed
00110                         * during filter evaluation as part of a query record.
00111                         *
00112                         * @return a set of {@link IndexLookupRecord}
00113                         */
00114                         virtual Set::View getIndexLookupRecords() const = 0;
00115 
00116                         /**
00117                         * Get the calculated cost of applying the filter as defined by
00118                         * {@link IndexAwareFilter#calculateEffectiveness(Map, Set)
00119                         * calculateEffectiveness}
00120                         *
00121                         * @return an effectiveness estimate of how well the associated
00122                         *         filter can use any applicable index
00123                         */
00124                         virtual size32_t getEfficiency() const = 0;
00125 
00126                         /**
00127                         * Get the size of the key set prior to evaluating the filter or
00128                         * applying an index.  This value can be used together with
00129                         * {@link #getPostFilterKeySetSize()} to calculate an actual
00130                         * effectiveness (reduction of the key set) for this filter step.
00131                         *
00132                         * @return the size of the key set prior to evaluating the filter
00133                         *         or applying an index
00134                         */
00135                         virtual size32_t getPreFilterKeySetSize() const = 0;
00136 
00137                         /**
00138                         * Get the size of the key set remaining after evaluating the
00139                         * filter or applying an index.  This value can be used together
00140                         * with {@link #getPreFilterKeySetSize()} to calculate an actual
00141                         * effectiveness (reduction of the key set) for this filter step.
00142                         *
00143                         * @return the size of the key set after evaluating the filter
00144                         *         or applying an index
00145                         */
00146                         virtual size32_t getPostFilterKeySetSize() const = 0;
00147 
00148                         /**
00149                         * Get the amount of time (in ms) spent evaluating the filter or
00150                         * applying an index for this query plan step.
00151                         *
00152                         * @return the number of milliseconds spent evaluating the filter
00153                         */
00154                         virtual int64_t getDuration() const = 0;
00155 
00156                         /**
00157                         * Return inner nested steps, may be null if not nested.
00158                         *
00159                         * @return the inner nested steps in the order they are applied
00160                         */
00161                         virtual List::View getSteps() const = 0;
00162                     };
00163 
00164                 // ----- inner interface: IndexLookupRecord -------------
00165 
00166                 /**
00167                 * An IndexLookupRecord holds the recorded information about an index
00168                 * lookup performed during filter evaluation as part of a query
00169                 * record.
00170                 *
00171                 * An IndexLookupRecord is created each time that
00172                 * {@link RecordableStep#recordExtractor(ValueExtractor)} is called on
00173                 * a query record step.
00174                 */
00175                 class COH_EXPORT IndexLookupRecord
00176                     : public interface_spec<IndexLookupRecord>
00177                     {
00178                     public:
00179                         /**
00180                         * Get a description of the extractor that was used for the index
00181                         * lookup.
00182                         *
00183                         * @return the extractor description
00184                         */
00185                         virtual String::View getExtractorDescription() const = 0;
00186 
00187                         /**
00188                         * Get a description of the associated index.
00189                         *
00190                         * @return the index description; null if no index was found
00191                         *         for the associated extractor
00192                         */
00193                         virtual String::View getIndexDescription() const = 0;
00194 
00195                         /**
00196                         * Indicates whether or not the associated index is ordered.
00197                         *
00198                         * @return true if the associated index is ordered; false if the
00199                         *         index is not ordered or if no index was found for the
00200                         *         associated extractor
00201                         */
00202                         virtual bool isOrdered() const = 0;
00203                     };
00204             };
00205     };
00206 
00207 COH_CLOSE_NAMESPACE2
00208 
00209 #endif // COH_QUERY_RECORD_HPP
Copyright © 2000, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.