Batch insert versus .u.upd

Hi all

I have some java code (via c.java) to add data to ticket plant and then publish to few other downstream, however, the performance is kind of bad, I believe it is because I call that function record by record. However can I call .u.upd with batch of records in a time?

Regards,
Carfield

send many records at a time:// (syms;prices;sizes) bulkint n=100;
Object[]x={new String[n],new double[n],new int[n]};for(int i=0;i<n;i++){
x[0][i]=..;
..
}c.ks(".u.upd","trade",x);

Thanks, let me try it out

 Hi, just wonder, I can create the object array like this

        Object x = { new String[n], new Double[n], new Integer[n] };

Right?

HI Charles, c.ks will throw nullpointerexception if I try to insert a record with null value, will you know how can I resolve that?

Hmmm,<o:p></o:p>

<o:p> </o:p>

I believe you mean c.java and not c.js. Have you checked this link? http://code.kx.com/wiki/Cookbook/InterfacingWithJava <o:p></o:p>

<o:p> </o:p>

Kim<o:p></o:p>

<o:p> </o:p>

he Kdb+ null values are mapped to Java values according to the following table:<o:p></o:p>

|

Kdb+ type<o:p></o:p>

|

Kdb+ null accessor<o:p></o:p>

|

Java null<o:p></o:p>

|
|

Boolean<o:p></o:p>

|

NULL(‘b’)<o:p></o:p>

|

Boolean(false)<o:p></o:p>

|
|

Byte<o:p></o:p>

|

NULL(‘x’)<o:p></o:p>

|

Byte(byte() 0)<o:p></o:p>

|
|

Short<o:p></o:p>

|

NULL(‘h’)<o:p></o:p>

|

Short(Short.MIN_VALUE)<o:p></o:p>

|
|

Integer<o:p></o:p>

|

NULL(‘i’)<o:p></o:p>

|

Integer(Integer.MIN_VALUE)<o:p></o:p>

|
|

Long<o:p></o:p>

|

NULL(‘j’)<o:p></o:p>

|

Long(Long.MIN_VALUE)<o:p></o:p>

|
|

Float<o:p></o:p>

|

NULL(‘e’)<o:p></o:p>

|

Float(Double.NaN)<o:p></o:p>

|
|

Double<o:p></o:p>

|

NULL(‘f’)<o:p></o:p>

|

Double(Double.Nan)<o:p></o:p>

|
|

Character<o:p></o:p>

|

NULL(‘c’)<o:p></o:p>

|

Character(’ ')<o:p></o:p>

|
|

Symbol<o:p></o:p>

|

NULL(‘s’)<o:p></o:p>

|

“”<o:p></o:p>

|
|

Timestamp<o:p></o:p>

|

NULL(‘p’)<o:p></o:p>

|

Timestamp(Long.MIN_VALUE)<o:p></o:p>

|
|

Month<o:p></o:p>

|

NULL(‘m’)<o:p></o:p>

|

Month(Integer.MIN_VALUE)<o:p></o:p>

|
|

Date<o:p></o:p>

|

NULL(‘d’)<o:p></o:p>

|

Date(Integer.MIN_VALUE)<o:p></o:p>

|
|

DataTime/java.util.Date<o:p></o:p>

|

NULL(‘z’)<o:p></o:p>

|

Timestamp(Long.MIN_VALUE)<o:p></o:p>

|
|

Timespan<o:p></o:p>

|

NULL(‘n’)<o:p></o:p>

|

Timespan(Long.MIN_VALUE)<o:p></o:p>

|
|

Minute<o:p></o:p>

|

NULL(‘u’)<o:p></o:p>

|

Minute(Integer.MIN_VALUE)<o:p></o:p>

|
|

Second<o:p></o:p>

|

NULL(‘v’)<o:p></o:p>

|

Second(Integer.MIN_VALUE)<o:p></o:p>

|
|

Time<o:p></o:p>

|

NULL(‘t’)<o:p></o:p>

|

Time(Integer.MIN_VALUE)<o:p></o:p>

|

<o:p> </o:p>

<o:p> </o:p>

Von: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] Im Auftrag von Carfield Yim
Gesendet: Samstag, 9. Januar 2016 08:52
An: personal-kdbplus@googlegroups.com
Betreff: Re: [personal kdb+] Batch insert versus .u.upd<o:p></o:p>

<o:p> </o:p>

HI Charles, c.ks will throw nullpointerexception if I try to insert a record with null value, will you know how can I resolve that?<o:p></o:p>

<o:p> </o:p>

On Mon, Jan 4, 2016 at 7:36 PM, Carfield Yim <carfield@gmail.com> wrote:<o:p></o:p>

 Hi, just wonder, I can create the object array like this

        Object x = { new String[n], new Double[n], new Integer[n] };

Right?<o:p></o:p>


Submitted via Google Groups

Thanks, let me try it out