AW: Use left hand column for null values

From: <kpi6288(at)gmail(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: AW: Use left hand column for null values
Date: 2018-01-19 17:01:51
Message-ID: !&!LgAAAAAAAADgysc3T9VPRqt6Rzq5kSxhAQDDto4Q93URzrTNAKoAu7bmAAAAAAAOAABGAAAAAAAAAODKxzdP1U9Gq3pHOrmRLGEHAMO2jhD3dRHOtM0AqgC7tuYAAAAAAA4AANlTnCJhprtFudq2LHCBs8EBAEcXAAAAAAAAAAAEAAAAuQAAACkAAABBVzogVXNlIGxlZnQgaGFuZCBjb2x1bW4gZm9yIG51bGwgdmFsdWVzAA==@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> [David G. Johnston]

> My $0.02​

>

> ​Unless you have some need to generalize I'd say ​just brute-force it and be done.

>

> You could maybe play with arrays to get something that looks different but I don't think it would be much shorter to code or easier to understand.

My concern was performance, because I feared that coalesce would evaluate e.g. column c1 50 times. But I did some testing and it seems to scale linear. 100,000 rows with 50 columns take 25 seconds on my test machine. Not exciting but something I can work with.

I played already with arrays but what I came up with was slower than the plain coalesce.

Klaus

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2018-01-19 17:15:13 Re: Query optimization with repeated calculations
Previous Message Robert McGehee 2018-01-19 16:03:48 Query optimization with repeated calculations