Oracle previously announced support for vector tiles in May 2024 with Oracle Database 23ai. “Vector tiles” is highly efficient, compressed spatial data format optimized for web mapping applications, unrelated to AI vector embedding and vector search. By using vector tiles, you can simplify building powerful maps from your data and enhance your web applications with integrated spatial analytics.
Great news: Working with Oracle Spatial vector tiles just got faster for Oracle Database 23ai developers! Oracle Spatial has now added support for vector tile caching to accelerate streaming vector tiles, making your maps more performant and user friendly.
This blog explains how exactly this vector tile caching works.
How Vector Tile Cache Works
Caching vector tiles enables faster retrieval and a better user experience in GIS applications. Oracle Spatial in Oracle Database 23ai enables a vector tile cache for a geometry column and zoom range on a table. This feature is disabled by default, and can be enabled using the enable_vector_tile() function. Once enabled, vector tiles will be automatically stored in SDO_VECTOR_TILE_CACHE$TABLE, so tiles can be retrieved from the cache, rather than generated from the geometry column in the base table. This can reduce the load time for a vector tile by skipping the tile generation process for cached tiles. Using automated triggers, the cache is kept in sync with the source tables without manual intervention. Let’s look at how this automated caching works.
Within Oracle Database 23ai, a simple SQL function call to get_vectortile() lets you generate vector tiles. Without caching, every call to the get_vectortile( ) function converts geometries from the base.
With the introduction of the vector tile cache, the get_vectortile( ) function first checks the cache for the tile. If it is found, then it will be returned to the application. If it is not found, it will generate and return the tile from the base table and, if the zoom level is within the range specified when enabling the vector tile cache, will seed the cache with the generated tile. Figure 1 below explains the workflow of how the cache is generated and kept in sync.
The cache uses automated triggers to keep it in sync with any changes to the base tables. Each Data Manipulation Language (DML) operation performs a spatial operation to check if the row being modified interacts with any of the tiles in the cache. This can be helpful for small DML operations, but it may increase the time for large DML operations. As a best practice, it is recommended to disable the caching before executing such large DML operations. When the cache becomes out of sync with the base table, it is also recommended you purge the cache for that table then enable the caching again to sync it.
Managing the caching lifecycle is simple using these five new procedures:
- enable_vectortile_cache(table_name, geom_col_name, min_zoom, max_zoom) – This enables vector tile caching on a given table, geometry column, and specified zoom range.
- disable_vectortile_cache(table_name, geom_col_name) – This disables vector tile caching on a given table and geometry column.
- purge_vectortile_cache(table_name) – This deletes all vector tiles from the cache that were generated from a given table
- grant_vectortile_cache(schema_name, read_only default false) – This allows owning schemas to grant other schemas access to their vector tile cache
- revoke_vectortile_cache(schema_name) – This allows owning schemas to revoke other schemas access to their vector tile cache
Applications that already uses vector tiles with Oracle Database 23ai can immediately take advantage of automated caching as soon as it’s enabled. More importantly, your users will transparently benefit from the better application performance.
For details, please see the documentation. We invite you to work with this new feature and experience the benefits of vector tile caching for your mapping apps.
For more information:
- Read: Make Better Maps for Your Apps with Spatial Vector Tiles and H3 in Oracle Database 23ai (link)
- Watch: Add Fast and Scalable Maps to your Apps with Vector Tiles and H3 in Oracle Database 23ai (link)
- Discover: Oracle Spatial (link)
- Try: Oracle Spatial and Spatial Studio on Autonomous Database Free (link)
