# Batch insert versus .u.upd

**URL:** <https://forum.kx.com/t/batch-insert-versus-u-upd/10698>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [January 1, 2016, 3:45pm UTC](https://forum.kx.com/t/batch-insert-versus-u-upd/10698 "2016-01-01T15:45:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![carfield11](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@carfield11](https://forum.kx.com/u/carfield11)\
**Post date:** [January 1, 2016, 3:45pm UTC](https://forum.kx.com/t/batch-insert-versus-u-upd/10698/1 "2016-01-01T15:45:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![charlie1](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@charlie1](https://forum.kx.com/u/charlie1)\
**Post date:** [January 1, 2016, 3:56pm UTC](https://forum.kx.com/t/batch-insert-versus-u-upd/10698/2 "2016-01-01T15:56:00Z")

</div>

```
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);

```

---

<div class="post-metadata">

**Author:** ![carfield1](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@carfield1](https://forum.kx.com/u/carfield1)\
**Post date:** [January 1, 2016, 4:06pm UTC](https://forum.kx.com/t/batch-insert-versus-u-upd/10698/3 "2016-01-01T16:06:00Z")

</div>

Thanks, let me try it out

---

<div class="post-metadata">

**Author:** ![carfield11](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@carfield11](https://forum.kx.com/u/carfield11)\
**Post date:** [January 4, 2016, 11:36am UTC](https://forum.kx.com/t/batch-insert-versus-u-upd/10698/4 "2016-01-04T11:36:00Z")

</div>

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

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

Right?

---

<div class="post-metadata">

**Author:** ![carfield1](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@carfield1](https://forum.kx.com/u/carfield1)\
**Post date:** [January 9, 2016, 7:51am UTC](https://forum.kx.com/t/batch-insert-versus-u-upd/10698/5 "2016-01-09T07:51:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kuentang](https://avatars.discourse-cdn.com/v4/letter/k/bc8723/32.png) [@kuentang](https://forum.kx.com/u/kuentang)\
**Post date:** [January 9, 2016, 8:08am UTC](https://forum.kx.com/t/batch-insert-versus-u-upd/10698/6 "2016-01-09T08:08:00Z")

</div>

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) [[mailto: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](mailto: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\>

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

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

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

–  
Submitted via Google Groups

---

<div class="post-metadata">

**Author:** ![carfield11](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@carfield11](https://forum.kx.com/u/carfield11)\
**Post date:** [January 9, 2016, 3:07pm UTC](https://forum.kx.com/t/batch-insert-versus-u-upd/10698/7 "2016-01-09T15:07:00Z")

</div>

Thanks, let me try it out
