# .NET kdb+ datareader

**URL:** https://forum.kx.com/t/net-kdb-datareader/8906
**Category:** Community Support
**Tags:** kdb-and-q
**Created:** [June 30, 2014, 11:19pm UTC](https://forum.kx.com/t/net-kdb-datareader/8906 "2014-06-30T23:19:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![inovitex](https://avatars.discourse-cdn.com/v4/letter/i/9d8465/32.png) [@inovitex](https://forum.kx.com/u/inovitex)
#### Post date: [June 30, 2014, 11:19pm UTC](https://forum.kx.com/t/net-kdb-datareader/8906/1 "2014-06-30T23:19:00Z")

</div>

Hi group,

I am trying to achieve best as possible data transfert performance from kdb+ to C# application. I tried all possible way, qODBC, qSharp, c.cs from kx but I have no impressive result yet!

What I mean by that:

q)meta table

c &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | t f a

--------------| -----

stock\_id &nbsp; &nbsp; &nbsp;| i &nbsp; g

time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| t &nbsp; s

last &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| f

last\_size &nbsp; &nbsp; | i

total\_volume &nbsp;| i

bid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | f

ask &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | f

basis\_for\_last| c

q)select count i from table where stock\_id = 926

x

* * *

218471

q)\t select from table where stock\_id = 926

13

The result takes 13ms on kdb+ console but ~200ms with c.cs. This is alot of overhead for the socket and I got the same result with an SQL Server on disk only.

Any tips?

---

<div class="post-metadata">

### Author: ![manni\_patel](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@manni\_patel](https://forum.kx.com/u/manni_patel)
#### Post date: [July 1, 2014, 7:15am UTC](https://forum.kx.com/t/net-kdb-datareader/8906/2 "2014-07-01T07:15:00Z")

</div>

Have you isolated the socket overhead vs network? If you have a slow network speed your \*.cs work is micro optimisation.

---

<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: [July 1, 2014, 11:00am UTC](https://forum.kx.com/t/net-kdb-datareader/8906/3 "2014-07-01T11:00:00Z")

</div>

using localhost  
kdb+ -\> kdb+/c api for such a resultset is ~5-10mS.  
kdb+ -\> c#, it’s \>200mS.

c.cs uses techniques found in other drivers - please let us know if you find better ways to do this. e.g. decoding floats seems particularly expensive.

There was a recent thread on c# performance; maybe that helps you.
