Search code examples
kognitio-wx2kognitiowx2

How to change the Queue Id in WX2?


Following is the current records from the QUEUES.

SELECT * FROM SYS.IPE_ALLQUEUES;

ID      NAME
------- ----------
100004  NAGIOS
1       DEFAULT
100003  OTHER
100002  APP
100001  ANALYST
0       NONQUEUED

ID column is currently defined as INTEGER and we are planning to change this as SMALLINT. So I need to change the id's as follows

SELECT * FROM SYS.IPE_ALLQUEUES;

ID      NAME
------- ----------
14      NAGIOS
1       DEFAULT
13      OTHER
12      APP
11      ANALYST
0       NONQUEUED

How can this be acheived in WX2?

Note: I am not asking about a simple update on the ids since this is a configuration meta data table for the WX2 engine. This is a bit intricate.


Solution

  • I don't think there is a way to specify the ids used in IPE_ALL_QUEUES, but there should be no benefit in them being SMALLINT rather than INT.

    If you are storing a very large number of references to this table elsewhere, you could see a benefit from those references being of type SMALLINT (in terms of reduced storage requirement, particularly if the references are in a RAM-based object).

    If so, you could add a layer of indirection which maps the SMALLINT (e.g. 14) to the required INT (e.g. 100004) - the indirection table would be replicated and tiny, and the cost of joining using it in addition to IPE_ALL_QUEUES and your large table with the SMALLINT would be negligible in terms of performance and RAM use.

    CREATE TABLE largeref(qref SMALLINT, ...);
    CREATE TABLE reflookup(qref SMALLINT, queue_id INT);
    -- populate lookup with entries like (14, 100004)
    -- populate largeref with SMALLINT references
    -- replicate reflookup
    
    SELECT Q.NAME, ...
    FROM ipe_allqueues q, reflookup r, largeref l
    WHERE q.id = r.queue_id
    AND r.qref = l.qref
    AND <other predicates on e.g. largeref>