For now I do not see the strong reason, but i inherited this project from
other developers,
Originally there was MongoDB and structure was more complex, having SNMP
like nested tables with OID.Instance1.Instance2.instance3 and in JSON it
looked like:
{
"1.3.6.1.4.1..3.10.2.2.25.4.1.43.1": {
Is there a reason not to use a relational model instead of json(b) here? I
think that is in fact considered best practice.
On Fri, 8 Mar 2019 at 15:40, Alexandru Lazarev
wrote:
> I am working on product managing and monitoring Network (NMS-like
> products).
>
> Product manages configuration of n
David Rowley writes:
> On Sat, 9 Mar 2019 at 01:25, Artur Zając wrote:
>> CREATE OR REPLACE FUNCTION smarteq(v1 int,v2 INT) RETURNS BOOL AS
>> $BODY$
>> SELECT (CASE WHEN v2 IS NULL THEN (v1 IS NULL) ELSE v1=v2 END);
>> $BODY$ LANGUAGE 'sql' IMMUTABLE PARALLEL SAFE;
> The transformation mentione
I am working on product managing and monitoring Network (NMS-like products).
Product manages configuration of network devices, for now each device has
stored its configuration in simple table - this was the original design.
CREATE TABLE public.configuration(
id integer NOT NULL,
config json N
On Sat, 9 Mar 2019 at 01:25, Artur Zając wrote:
> I made some workaround. I made function:
>
> CREATE OR REPLACE FUNCTION smarteq(v1 int,v2 INT) RETURNS BOOL AS
> $BODY$
> SELECT (CASE WHEN v2 IS NULL THEN (v1 IS NULL) ELSE v1=v2 END);
> $BODY$ LANGUAGE 'sql' IMMUTABLE PARALLEL SAFE;
> ex
> In short, probably possible, but why not just write an equality clause, if
> you know NULLs are not possible?
In fact I construct query like this (usually in pl/pgsql).
SELECT column FROM table WHERE column1 IS NOT DISTINCT FROM $1 AND column2 IS
NOT DISTINCT FROM $2;
"IS NOT DISTINCT FROM
On Sat, 9 Mar 2019 at 00:30, Artur Zając wrote:
> Is there any reason that „NOT DISTINCT FROM” can’t be autotransformed to „=”
> when value on right side of expression is not NULL or is this any way to use
> index with „IS NOT DISTINCT FROM” statement?
Probably nothing other than nobody has don
Artur Zając wrote:
> Is there any reason that „NOT DISTINCT FROM” can’t be autotransformed to „=”
> when value
> on right side of expression is not NULL or is this any way to use index with
> „IS NOT DISTINCT FROM” statement?
That would subtly change the semantics of the expression:
test=> SELE
I have some query:
EXPLAIN ANALYZE select id from sometable where fkey IS NOT DISTINCT FROM
21580;
QUERY PLAN
---