HANA so far has been excellent providing Row and column store But as they say, there is always scope of improvement and SAP proving it again.
SAP HANA now also includes a DocStore. Not unlike MongoDB, the SAP HANA JSON Document Store enables the developer to store and manage JSON documents (artifacts) with support for native operations on JSON including filtering, aggregation, and joining JSON documents with HANA relational tables. We are not talking about storing JSON as CLOB in a regular database column, in other words – the quick and dirty way
Doc store service:
The Document Store is an optional feature of the SAP HANA database and you have to enable the docstore operating system process per tenant database.
The DocStore does not have a pre-determined SQL port, all communication is routed through the regular indexserver (database engine) process
It will require 14 GB of space specifically on tenant Basis.
Procedure to Setup
As HANA 2.0 SPS01 on wards, it is only MDC so providing only way for Multi DB.
For multi-database instances, there can be 0 (none) or 1 (one) DocStore per tenant database; you can enable the DocStore in a database tenant by running the following command as administrator in the SQL console:
ALTER DATABASE <database> ADD ‘docstore’
You can add to particular hostname and port also
Alter database <SID> add ‘docstore’ at location ‘<hostname>:<Available Port>’
You can find the already used ports using below command
SELECT DATABASE_NAME, SERVICE_NAME, PORT, SQL_PORT, (PORT + 2) HTTP_PORT FROM SYS_DATABASES.M_SERVICES
Alter database <SID> remove ‘docstore’ at location ‘<hostname>:<port>’
NOTE: If you remove the docstore service, you will lose all the data stored in docstore.
Operations on JSON document
Login to Tenant DB using HANA studio or hdbsql or hana cockpit, We just want SQL editor , anyway from mentioned way as per one’s comfort.
Run a query for operations on JSON format. If you are developer or ABAPer it will be very easy to run queries. If you know JSON coding, it will be easy to work in HANA also like Select, update, delete, rename to name a few
Showing example of hdbsql also and running delete query as below:
DELETE FROM CUSTOMERS
You can also rename JSON documents also similar like running sql queries.
This way SAP has improved another feature of HANA and now you can store your documents directly into HANA using DocStore service.