What is Change Views?
Change Views uses InterBase multigenerational architecture (also known as MVCC) to capture changes to data. This feature allows you to quickly answer the question, “What data has changed since I last viewed it?”
Change Views can be subscribed by any number of subscribers using any number of end user devices/applications independently, in order to view data that has changed across database connections. The effect is a long-lived transaction spanning multiple database connections. Specifically, the subscription tracks all row inserts, updates, and deletes to one or more tables at a column-level granularity over a disconnected, extended period of time.
Why is the feature valuable?
Change Views leverages InterBase’s data versioning engine to provide an easy mechanism for application developers to build in data change tracking inside their database without making any schema level change, or implementing time-consuming and inflexible alternative change tracking designs via timestamps and triggers.
For developers using RAD Studio, Change Views is also supported natively in FireDAC to quickly merge changes to local data. To see how this could be put to best use with InterBase Change Views by exploring further with the links provided below.
Potential Use Cases
There are many use cases that can benefit from Change Views. Here are a few…
- Application architectures needing some form of data caching at different tiers. The front or middle tiers can fetch whatever data they need from the remote database, and cache it locally in local (embedded) databases or in memory. Over time, the same requests can be run against the remote database to fetch only changed data that can be merged with the local cache. This is very beneficial by reducing any bandwidth costs and performance latency between the client(s) and the remote server.
- Applications running custom queries per device/user, including data filters in SQL WHERE conditions, can have their queries run through subscribed tables. The database server will fetch and send back only the relevant changed data instead of sending back all records that match the filter conditions.
- Applications using other mechanisms to implement “trigger-based” replication scenarios for important tables for each subscriber can replace those costly methods with Change Views subscriptions. This provides both data deduplification benefits (no copies of data per subscriber), and also provides database administrators clear view into how far along the subscribers have refreshed their data.
- Applications that have the same user using it on various devices (Windows desktop, iOS, and Android devices) can now use Change Views to identify themselves as the same user to the database engine. When the user transitions from Desktop to Mobile device back and forth, the application querying for changed data will know what needs to be sent back to the user without giving them the same data they have seen before.
- Change Views provide every record’s status (Inserted, Updated, Deleted) along with the subscribed result set. Applications can use this information to streamline user workflow when merging information back to the local data cache.
- Using Change Views, subscribed users management is trivial. DDL commands like GRANT/REVOKE give the administrator great flexibility to expand or reduce the use of such subscribed tables and subscribers.
How is this feature different from other solutions?
Other database vendors implement changed data tracking using triggers, logging, and/or transaction write-ahead log scraping. This is time-consuming for the developer and affects the database performance for a certain transaction load or change volume. With InterBase Change Views, there is no performance overhead on existing transactions because it maintains a consistent view of changed data observable by other transactions.
InterBase Change Views also provide a rich set of DDL (Data Definition Language) commands that help the developer/administrator to easily setup changed data tracking. Some appealing use cases are listed above.
Explore Further
- Docwiki: http://docwiki.embarcadero.com/InterBase/2017/en/Change_Views
- Youtube videos:
- Why InterBase: https://www.youtube.com/watch?v=v0rLqJFtZQI&t=2585s
- Simplify Data Change tracking: https://www.youtube.com/watch?v=nQ8I3XV58GM
- InterBase Events and Change Views with Callback function (for RAD users): https://www.youtube.com/watch?v=Llk-nu2VShQ
- RAD Studio users:
- Product Portal:
- https://www.embarcadero.com/products/interbase
- https://www.embarcadero.com/interbase-resources
- https://www.embarcadero.com/starthere/interbase/