Skip Headers

Oracle9i OLAP Developer's Guide to the OLAP API
Release 2 (9.2)

Part Number A95297-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Understanding Cursor Classes and Concepts, 6 of 6


About Fetch Sizes and Fetch Blocks

An OLAP API Cursor represents the entire result set for a Source. The Cursor is a virtual Cursor, however, because it retrieves only a portion of the result set at a time from Oracle OLAP. A CursorManager manages a virtual Cursor and retrieves results from Oracle OLAP as your application needs it. By managing the virtual Cursor, the CursorManager relieves your application of a substantial burden.

The amount of data that a Cursor retrieves in a single fetch operation is determined by the fetch size specified for the Cursor. For a CompoundCursor, the amount of data fetched in a single operation is the product of the fetch sizes of all of its descendent ValueCursor objects. The total set of values retrieved in a single fetch is the fetch block for the Cursor. You specify fetch sizes in order to limit the amount of data your application needs to cache on the local computer and to maximize the efficiency of the fetch by customizing it to meet the needs of your method of displaying of the data.

When you create a CursorManagerSpecification for a Source, as the first step in creating a Cursor, Oracle OLAP specifies a default fetch size on the root CursorSpecification of the CursorManagerSpecification. By calling methods on the CursorSpecification objects of the CursorManagerSpecification, you can specify a default fetch size or specify setting the fetch size at other levels of a CompoundCursor.

If the fetch size is specified on a CursorSpecification, then you can get or set the fetch size for the corresponding Cursor by calling the getFetchSize or setFetchSize method on that Cursor. For a CompoundCursor, you can set different fetch sizes for child Cursor objects at different levels in the outputs.

A Cursor has a local fetch size if the size of the fetch block is specified for that Cursor. Not all of the Cursor objects in a CompoundCursor can have local fetch sizes. The structure of a CompoundCursor is like a tree, with the hierarchy of Cursor objects starting at the topmost (root) Cursor and going down through all the child Cursor objects. Any path through the hierarchy, starting from the root and going down to a leaf ValueCursor, can contain one, and only one, Cursor with a local fetch size. Specifying the fetch size on a parent Cursor affects all of the child Cursor objects of that parent. This means that a fetch block can contain no more than the number of elements of each child Cursor specified by the fetch size. Figure 8-8 shows an example of a path through the hierarchy of a Cursor tree in which the Cursor objects with local fetch sizes are shaded.

Figure 8-8 A Local Fetch Size Path Through a Cursor Hierarchy


Text description of locfsize.gif follows
Text description of the illustration locfsize.gif

About Determining the Shape of a Fetch Block

In a CompoundCursor, the levels at which you set the fetch sizes determine the shape of the fetch block of the CompoundCursor. The optimal fetch block for a CompoundCursor depends on the way you intend to navigate the Cursor and display the data. After determining how to display the data, you should do the following:

For examples of specifying fetch sizes and fetch blocks for different displays, see Chapter 9.

About Sharing Fetch Blocks

You can create two or more Cursor objects from the same CursorManager and use both Cursor objects simultaneously. The Cursor objects can share the data managed by the CursorManager, rather than having separate data caches, because the shape of the fetch blocks is the same for both Cursor objects. The shape of the fetch blocks is determined by the levels of the CursorManagerSpecification on which the fetch size is specified.

An example is an application that displays the results of a query to the user as both a table and a graph. The application creates a CursorManagerSpecification for a Source and then creates a CursorManager for the CursorManagerSpecification. The application creates two separate Cursor objects from the same CursorManager, one for a table view and one for a graph view. The two views share the same query and display the same data, just in different formats. Figure 8-9 illustrates the relationship between the Source, the Cursor objects, and the views.

Figure 8-9 A Source and Two Cursors for Different Views of Its Values


Text description of crsvlvus.gif follows
Text description of the illustration crsvlvus.gif

Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2000, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback