Running Recommender examples

The workload-insights archive includes sample queries and explain plans that demonstrate the recommender. You gain an understanding of the recommender by running examples.

In local mode, you do not get actual recommendations, but you experiment with and understand recommendations using this mode without incurring any cloud costs.The recommender examples you can run use one or both of the following queries as input:

QueryA

SELECT sr_item_sk, sum(sr_net_loss) AS net_loss
FROM store_returns
INNER JOIN reason ON sr_reason_sk = r_reason_sk
WHERE r_reason_desc = 'Found a better price in a store'
GROUP BY sr_item_sk   
Query A asks these questions:
  • Which items were returned because the customer found a better price?
  • How much money did the company lose on each returned item?

QueryB

SELECT sr_item_sk, sum(sr_net_loss) as net_loss, avg(ss_sales_price) as price
FROM store_sales
INNER JOIN store_returns
  ON ss_item_sk=sr_item_sk AND ss_ticket_number=sr_ticket_number
INNER JOIN reason
  ON sr_reason_sk = r_reason_sk
WHERE r_reason_desc = 'Found a better price in a store'
GROUP BY sr_item_sk
ORDER BY net_loss DESC NULLS LAST, price DESC NULLS LAST
LIMIT 10  
QueryB asks these questions:
  • Which items were returned because the customer found a better price?
  • How much money did the company lose on each returned item?
  • What was the average selling price of return items?
  • What are the top ten items causing the biggest loss?
  • The mini-hs2 docker image is running.
  • You downloaded and unpacked the workload-insights archive, and it includes the following sample queries that you need to provide as input to the Workload Insights (wi) script:
    • Directories containing select and aggregation queries in .sql files

      A .sql file name suffix is required.

    • Directories containing explain plans in .json files

      A .json file name suffix is required.