I have a large number of queries, some of which can take half an hour, many of these queries return more than 20 or so columns (yes, they are normalized). I am interested in storing all this data in one table, in a format for time stamping, name, value, resonance is used for this for subsequent data automation.
However, when I have a request that returns
T1, V1t1, V2t1, V3t1 T2, V1t2, v2t2, v3t2
and I want to have data in the format
T1, Name(V1), V1t1 T1, Name(V2), V2t1 T1, Name(V3), V3t1 T2, Name(V1), V1t2 T2, Name(V2), V2t2 T2, Name(V3), V3t2
I know, I could do this by doing a select join for each value of v1, v2 and v3,
however, I am interested in speed and would like to refrain from issuing 3 requests, where I can receive data (albeit in wroung format) in one .. or in the real case, refrain from issuing 20-30 requests, where it can do in one.
so the question is whether there is a way to do this other than dumping into a temporary table and then selecting into the appropriate columns of the table and joining them together.
is this possible with the custom postgresql function?
early