KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ IPC

  • IPC

    Posted by ngumbo on March 1, 2022 at 12:00 am

    Hey Team,

    I’m currently working through IPC and am working on creating a query log table to store all queries done on a process. I am attempting to modify .z.pi so that for each query ran in q it updates a query table. This is my current query:

                   .z.pi:{ `queryTable insert (.z.ts; enlist string x) ; value x}

    While this adds queries to the table it does not carry out the operation on the q command line. Is this the right way to approach this sort of task ? Any alternatives would be appreciated if not.

    ngumbo replied 6 months, 3 weeks ago 2 Members · 2 Replies
  • 2 Replies
  • pmallon

    Member
    March 1, 2022 at 12:00 am

    Hi,

    I think you might want to use .z.ps/.z.pg for this, does the below do what you want?

    q)admin:([]query:();time:`timestamp$();user:`$();handle:`int$())
    
    
    q).z.ps:{`admin upsert enlist ( x 0;.z.p;.z.u;.z.w);value x;}
    q).z.pg:{`admin upsert enlist ( x 0;.z.p;.z.u;.z.w);value x}
    q)0 (+;1;2) / run on local p
    q)admin query time user handle -------------------------------------------------- + 2022.03.01D13:14:16.858901000 pm 0
  • ngumbo

    Member
    March 1, 2022 at 12:00 am

    Yes this is more or less what I was looking for Thanks a million! I got in my head that .z.pi was essential thanks for clearing that up!

Log in to reply.