Re: [SQL] [noob] How to optimize this double pivot query?

2012-10-01 Thread Thomas Kellerer
Robert Buck, 02.10.2012 03:13: So as you can probably glean, the tables store performance metric data. The reason I chose to use k-v is simply to avoid having to create an additional column every time a new metric type come along. So those were the two options I thought of, straight k-v and colum

Re: [SQL] [noob] How to optimize this double pivot query?

2012-10-01 Thread David Johnston
Two issues... 1. I do not know how you acquire the data or who controls how/what is generated 2. I do not know the primary means of using said data If you capture a new metric you generally have to change quite a few things to actually use it so you might as well just add a column as well. If yo

Re: [SQL] [noob] How to optimize this double pivot query?

2012-10-01 Thread Robert Buck
So as you can probably glean, the tables store performance metric data. The reason I chose to use k-v is simply to avoid having to create an additional column every time a new metric type come along. So those were the two options I thought of, straight k-v and column for every value type. Are ther

Re: [SQL] [noob] How to optimize this double pivot query?

2012-10-01 Thread David Johnston
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Robert Buck Sent: Monday, October 01, 2012 8:47 PM To: pgsql-sql@postgresql.org Subject: [SQL] [noob] How to optimize this double pivot query? I have two tables that contain key-value data that I want to

[SQL] [noob] How to optimize this double pivot query?

2012-10-01 Thread Robert Buck
I have two tables that contain key-value data that I want to combine in pivoted form into a single result set. They are related to two separate tables. The tables are: test_results, test_variables, metric_def, metadata_key. The latter two tables are enum-like tables, basic descriptors of data stor

Re: [SQL] Reuse temporary calculation results in an SQL update query

2012-10-01 Thread Thomas Kellerer
Matthias Nagel wrote on 29.09.2012 12:49: Hello, is there any way how one can store the result of a time-consuming calculation if this result is needed more than once in an SQL update query? This solution might be PostgreSQL specific and not standard SQL compliant. Here is an example of what

Re: [SQL] Reuse temporary calculation results in an SQL update query

2012-10-01 Thread Jasen Betts
On 2012-09-29, Matthias Nagel wrote: > Hello, > > is there any way how one can store the result of a time-consuming calculation > if this result is needed more than once in an SQL update query? This solution > might be PostgreSQL specific and not standard SQL compliant. Here is an > example of

Re: [SQL] HOw to convert unicode to string

2012-10-01 Thread Jasen Betts
On 2012-09-23, Abhijit Prusty -X (abprusty - UST Global at Cisco) wrote: > --_000_8A2A33BFAA5E2F408D0BBB80844412720487D0xmbalnx03ciscocom_ > Content-Type: text/plain; charset="us-ascii" > Content-Transfer-Encoding: quoted-printable > > Hi, > > I have a query in oracle like this mentioned below >