Just an observation that might warrant further research.
With xtuple 5.0 I've been unable to get a "taxHistory" detail report to run since doing the upgrade several weeks ago. When I start the query I just give up and intentionally crash the program after 30 minutes with no results. In experimenting with the metasql called by that report I see the joins include the two views named "dochead" and "docitem". Those two views appear to be problematic for me. My "docitem" table/view has about 1.5million rows returned. It is a convenient way to access all sorts of doc types but I think it needs a little fine tuning. In one test query I worked on when I included the dochead and docitem joins it took ~3 Minutes to return 3 records. When I commented out dochead and docitem from the join the same query (minus the fields for the doc tables) took 32 millisecs.