Skip to Content

Overview

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

 

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 

 

Removing Service

Alter database <SID> remove ‘docstore’ at location ‘<hostname>:<port>’

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.

 

 

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Steve Guo

    It’s  a great function.

    I can image one of the usage of this function is to store customer defined fields dynamically without change the structure of table.

    But as you mentioned, the data in json can do sql calculation with data in table, can I get the same poformance compare to traditional way?

    (0) 
  2. Naveen Kumar Post author

    Thank you Steve for Kind words.

     

    Data stored in collection format rather than as sql table hence sql statements used slightly differently. We expect the same performance as well. We have tested on small amount of collection data. which was swift.

    (0) 
    1. Bill McGagh

      Hello Naveen, Is there add’l tech documentation available (e.g. full functions available) beyond HANA 2.1 dev guide. Our client’s very interested in getting moving with this capability.

      (0) 

Leave a Reply