13

© 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

1© 2010 Oracle Corporation – Proprietary and Confidential

Page 2: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

2© 2010 Oracle Corporation – Proprietary and Confidential

<Insert Picture Here>

© 2009 Oracle Corporation – Proprietary and Confidential

Coherence 3.7.1 Query Explain Plan

Noah Arliss Development Manager (Sheriff) Oracle Coherence

Page 3: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

Coherence Queries:

•  Programmatic query mechanism •  Queries performed in parallel across the grid •  Standard indexes provided out-of-the-box and supports

implementing your own custom indexes •  Cost-based analysis of Filter application •  Standard Filters provided out-of-the-box (e.g. OR,

AND, ALL, EQUALS, etc.)

Page 4: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

Data Processing: Parallel Query

// get the “myTrades” cache

NamedCache cacheTrades = CacheFactory.getCache(“myTrades”);

// create the “query”

Filter filter = new AndFilter(new EqualsFilter("getTrader", traderid),

new EqualsFilter("getStatus", Status.OPEN));

// perform the parallel query

Set setOpenTrades = cacheTrades.entrySet(filter);

Page 5: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

Data Processing: Parallel Query

Page 6: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

Data Processing: Parallel Query

Page 7: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

Query in more detail

No Index Index

Page 8: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

Data Processing: Parallel Query

Page 9: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

Data Processing: Parallel Query

Page 10: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

Optimizing Parallel Queries

•  Indexing will greatly improve the performance of our queries –  By reducing the number of entries to scan… –  Because Indexed value objects are already de-serialized…

•  How can I determine what to index

Page 11: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

11© 2010 Oracle Corporation – Proprietary and Confidential

The Query Explain Plan

•  Evaluate a query’s cost and effectiveness.

•  Uses existing aggregation API.

•  Produces a query record.

•  Contains information for each step (filter) that makes up the query.

•  EXPLAIN PLAN

•  Estimated cost of evaluating a filter as part of a query operation.

•  TRACE

•  Provides the actual cost of evaluating a filter as part of a query operation.

•  Actually runs the query in the cluster.

Page 12: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

12© 2010 Oracle Corporation – Proprietary and Confidential

How to Create a Query Record? QueryRecorder & QueryRecord

•  QueryRecorder is a special EntryAggregator.

•  Signals Coherence to return a query record from the aggregation.

•  Aggregates the partial results into a query record.

•  Supports two types … EXPLAIN and TRACE.

•  QueryRecord carries information regarding the estimated or actual execution cost for a query operation.

// Get a query record for the given filter

QueryRecord record = (QueryRecord) cache.aggregate(filter,

new QueryRecorder(RecordType.EXPLAIN));

Page 13: © 2010 Oracle Corporation – Proprietary and Confidential · Coherence-3.7.1-Explain.ppt Author: NOAH ARLISS Created Date: 11/8/2011 8:07:09 PM

13© 2010 Oracle Corporation – Proprietary and Confidential

Query Explain Plan Demo