I've a lot of queries most of which may take 30 minutes to operate, a number of these queries return over 20 approximately posts( yes they're normalised). I'm thinking about storing all this data in one table, within the format for Timestamp, title, value, the reson for to later automation around the data.

However, if I've got a query that returns

T1, V1t1, V2t1, V3t1
T2, V1t2, v2t2, v3t2
--   --    --    --

and If only to achieve the data in 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 understand I Possibly Could do that using a union on chooses for every value v1, v2 and v3,

however am thinking about speed and want to avoid giving 3 queries where I'm able to obtain the data(although within the wroung format) in a single.. or perhaps in the actual situation avoid giving 20-30 queries where it may be completed in one.

so now you ask , , it is possible to method of doing this aside from dumping right into a temporary table and running subsequent chooses to the relevant posts on the table and unioning them together..

would this be possible having a custom made postgresql function?

thanks ahead of time

This really is completely possible having a custom PostgreSQL function. You may even have the ability to make use of the tablefunc module and employ the [cde] function to complete what you would like. It appears like you are attempting to accomplish an unpivot in PostgreSQL, to have more use using this subscriber list thread Unpivot with PostgreSQL

You are able to achieve what you would like having a variant from the following query.