KX Community

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

Home Forums KX Solutions RDB/IHDB/HDB – What is the best way of a copy of the values of an in-memory table? Re: RDB/IHDB/HDB – What is the best way of a copy of the values of an in-memory table?

  • Laura

    Administrator
    July 6, 2021 at 12:00 am

    Hi Adriano,

    We’ve had a look at your example and for in-memory tables your first solution appears to work perfectly as long as you are passing a reference into your function.

    for example:

     

    doSomething[`tablename]

     

    However if you were working with an on-disk table rather than an in-memory table your solution could be simplified to

     

    q)r:`sym xkey select from tableName

     

    using the select function in order to pull your table into memory first.

    Your functional form solution works fine however most people will use q-SQL as it is a more readable format. A where clause can be used alongside the select query to avoid pulling in a large amount of data from disk.

    Cheers, 

    Kate