Is there a way to select a structure of a database row and send it once from a server to a client and after that send thousands of rows? Doesn’t repeating the same metadata for each row create huge overhead?
Typically, depending upon the server that you’re working with, the metadata is sent independently of the data itself. For example, if you look at the metadata that’s produced from SQL Server’s XML export, the metadata block for the XML appears first, then the row information is presented as a series of attributes for each row, with one attribute corresponding to a field representation in the initial metadata block. This cuts down considerably on the overhead.
Once the XML Schema architecture is finalized, that will provide another level of abstraction. When you make a request from a database that supports that architecture, you will get a schema representation and a data representation, possibly within the same document, possibly not (depending upon the server). Either way, the actual information that is contained within the records themselves is minimal, but you can reconstruct type and parametric information easily from the schema.