Portfolio Holdings Data: Analytics Content Retrieval
- Claude Paugh
- Apr 15
- 2 min read
Updated: Jun 24
In a previous post I had stated that one of the reasons I wanted to try Couchbase was the built-in analytics service. It's accessible from the menu on the left of the UI, just below the the "Search" item:

The analytics console looks very much like the query console with the exception of the panels on the right. This is where you can map data structures from the local or remote Couchbase collections as sources. The analytics service makes a copy of the original data, and provides the ability to index it separately from the original source.

As you can see on the left, the "Local" location has a 1-1 mapping back to the source. It does offer the ability to subset, but I decided to start with the entire collection.
The "Analytics Views" consist of SQL++ queries, much like relational databases support views. Below are examples of view definitions, and what result sets look like in the expandable lists.
Unfortunately, the indexing and data storage capabilities in the analytics service do not allow partitioning of either data or indexes.
It does not provide a "where" clause on indexes so you can mimic partitioning, so I encountered very long query runtimes for metrics on a Fund Series level even if only over one period date. There were other views impacted as well.
Couchbase has tried to rectify this by introducing its Couchbase Capella Columnar with it's cloud offerings.
Fund Series Collateral View
SELECT PeriodEndDate, CIK, SeriesName, ROUND(TONUMBER(aggregateCondition.aggregateInfos.aggregateInfo.amt), 2) AS Amount, ROUND(TONUMBER(aggregateCondition.aggregateInfos.aggregateInfo.collatrl), 2) AS Collateral_Amount, aggregateCondition.aggregateInfos.aggregateInfo.invstCat AS Investment_Category, ROUND(TONUMBER(aggregateCondition.aggregateInfos.aggregateInfo.amt) - TONUMBER(aggregateCondition.aggregateInfos.aggregateInfo.collatrl),2) AS Collateral_Gap FROM FundParents WHERE aggregateCondition.isNonCashCollateral = 'Y'Fund Series Collateral Results

Money Flows View
SELECT i.PeriodEndDate, i.SeriesName, ROUND(TONUMBER(i.netAssets), 2) AS netAssets, ROUND(SUM(TONUMBER(i.mon1Flow.sales)+TONUMBER(i.mon1Flow.reinvestment)-TONUMBER(i.mon1Flow.redemption)), 2) AS month1Flows, ROUND(SUM(TONUMBER(i.mon2Flow.sales)+TONUMBER(i.mon2Flow.reinvestment)-TONUMBER(i.mon2Flow.redemption)), 2) AS month2Flows, ROUND(SUM(TONUMBER(i.mon3Flow.sales)+TONUMBER(i.mon3Flow.reinvestment)-TONUMBER(i.mon3Flow.redemption)), 2) AS month3Flows FROM FundParents i GROUP BY i.PeriodEndDate, i.SeriesName, i.netAssets ORDER BY i.PeriodEndDate DESCMoney Flows Results

Fund Trailing 3Month Flows (uses MoneyFlows)
SELECT PeriodEndDate, SeriesName, ROUND((TONUMBER(month1Flows)+TONUMBER(month2Flows)+TONUMBER(month3Flows)),2) AS net3MoFlows, netAssets FROM MoneyFlows ORDER BY net3MoFlows DESCFund Trailing 3Month Flows Results

Analytics Graph(s) in Couchbase; downloads to PNG

