Reports from XML Data :: SQL Server 2012

A company that hired you as a consultant uses a website to get reviews of their products from their customers. They store those reviews in an XML column called reviewsXML of a table called ProductReviews. The XML column is validated against a schema and contains, among others, firstname, lastname, and datereviewed elements. The company wants to generate a report with names of the reviewers and dates of reviews. Additionally, because there are already many very long reviews, the company worries about the performance of this report.
  1. How could you get the data needed for the report?

  2. What would you do to maximize the performance of the report?
  1. You could use the value() XML data type method to retrieve the scalar values needed for the report.

  2. You should consider using XML indexes in order to maximize the performance of the report.