Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

To cache or materialize?

719387Mar 9 2010 — edited Mar 10 2010
Hi all,

I have a table with a few thousand rows of SDO_GEOMETRY (simple curves), and a view that returns the results of operations on them as follows:


CREATE TABLE BASE_GEOM
(
ID NUMBER,
CONTOUR MDSYS.SDO_GEOMETRY
)

/* ... populate this table with a bunch of closed curves ... */

CREATE OR REPLACE FORCE VIEW VW_DERIVED_VALS
AS
SELECT BG.ID,
SDO_GEOM.SDO_AREA (BG.CONTOUR, 0.005) AREA
FROM BASE_GEOM BG;

On a regular basis, I want to return the AREA field for a large subset of the rows in the table. Since this AREA field only changes when the underlying CONTOUR field changes, is there any way that I can pre-compute the result (ie, at the time of insert/update to the BASE_GEOM table), and simply return this result from memory, rather than calculating the AREA every time it is requested?

I have a feeling the answer might be materialized views, but every example I've seen for materialized views is based on the idea that a query is run at some other time (ie, midnight each night), and on a whole data set, rather than at the time of insert/update and only on a single row.

Thanks,
Sven.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2010
Added on Mar 9 2010
4 comments
1,831 views