Patent ID: 7490097

Claim:
An apparatus comprising: a computer processor; a memory coupled to the computer processor; a semi-structured data storage schema portion, a workload schema portion, and a semi-structured data storage schema selection portion stored in the memory executed by the computer processor; the semi-structured data storage schema portion for providing semi-structured data, wherein the semi-structured data comprises a semi-structured data storage schema and a semi-structured data storage; the workload schema portion for providing workload input, wherein the workload input comprises structured queries; the semi-structured data storage schema selection portion for: selecting an improved semi-structured data storage schema for a relational schema in response to the semi-structured data and in response to the workload input, wherein the improved semi-structured data storage schema is selected by using an initial state represented within the semi-structured data; calculating a cost for the initial state, wherein the cost is based on a cost model, wherein the cost model includes parameters comprising an instance number of an element, a field width of the element, an average fan out from one element to another element, a number of elements in an extend of a field, a size of the extend of a fragment, a selectivity of a simple path, and the selectivity of a path from a root to the fragment; transforming the initial state within the semi-structured data to a neighboring state represented within the semi-structured data and the semi-structured data storage schema selection portion segments the semi-structured data based on the selected improved semi-structured data storage schema, wherein the semi-structured data storage schema selection portion is based on a hillclimbing algorithm; comparing the cost of the initial state to the cost of the neighboring state; and determining whether the cost of the neighboring state is smaller than the cost of the initial state, wherein the cost of the neighboring state is smaller, the neighboring state is used.