Avoiding wsfull

893 views
Skip to first unread message

Michael

unread,
Feb 9, 2011, 5:20:16 PM2/9/11
to Kdb+ Personal Developers
Hi everyone, I have just loaded two large splayed q databases with
264361663 and 187823972 rows.
The DB called trade has a DATE column and I run the querries

exec DATE from select distinct DATE from trade
exec distinct DATE from nbbo

which both give "wsfull" errors and crashes.
The querry should not take a lot of memory (about 1 years worth of
dates) but I don't know how to fix this. Could someone help?


Aaron Davies

unread,
Feb 9, 2011, 6:45:04 PM2/9/11
to personal...@googlegroups.com
Possibly break it up?

q)(union)over{exec distinct DATE from trade where DATE.month=x}each m

where m is an exhaustive list of months in the db (e.g. 2010.01
2010.02 2010.03m)

> --
> You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
> To post to this group, send email to personal...@googlegroups.com.
> To unsubscribe from this group, send email to personal-kdbpl...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/personal-kdbplus?hl=en.
>
>

--
Aaron Davies
aaron....@gmail.com

Tim Rieder

unread,
Feb 9, 2011, 7:04:54 PM2/9/11
to personal...@googlegroups.com
I'm assuming DATE is an actual column and not a virtual column... or
did you remove your DATE column and splay it daily using .Q.dpft with
the partition being the distinct value of DATEs for that block?

Tim Rieder

unread,
Feb 9, 2011, 7:13:58 PM2/9/11
to personal...@googlegroups.com
I'm curious, does this work:

{count x[];.Q.PV where not 0=.Q.pn x}`trade

Michael

unread,
Feb 10, 2011, 3:31:42 PM2/10/11
to Kdb+ Personal Developers
I get the following complaint:
".Q.pn"

On Feb 9, 7:13 pm, Tim Rieder <trie...@gmail.com> wrote:
> I'm curious, does this work:
>
> {count x[];.Q.PV where not 0=.Q.pn x}`trade
>
>
>
> On Wed, Feb 9, 2011 at 7:04 PM, Tim Rieder <trie...@gmail.com> wrote:
> > I'm assuming DATE is an actual column and not a virtual column... or
> > did you remove your DATE column and splay it daily using .Q.dpft with
> > the partition being the distinct value of DATEs for that block?
>

Michael

unread,
Feb 10, 2011, 3:39:24 PM2/10/11
to Kdb+ Personal Developers
I'm not sure. The table was create this way:
colnames:`SYMBOL,`DATE,`TIME,`PRICE,`SIZE,`EX;
.Q.fs[{ .[`:q/data/db/trade/; (); ,; .Q.en[`:q/data/db] flip colnames!
("SDTFIS";",")0:x]}]`:q/data/taqtrade.csv
Let me know if that helps.

Aaron Davies

unread,
Feb 10, 2011, 4:15:41 PM2/10/11
to personal...@googlegroups.com
pn is only present when a partitioned hdb has been loaded. If your
tables are plain allayed tables, that code won't work.

Aaron Davies

unread,
Feb 10, 2011, 4:17:57 PM2/10/11
to personal...@googlegroups.com
Yeah, that's a plain splayed table, not a partitioned table.

Did my earlier suggestion work?

On Thursday, February 10, 2011, Michael <princet...@gmail.com> wrote:

Michael

unread,
Feb 10, 2011, 5:03:39 PM2/10/11
to Kdb+ Personal Developers
Hi, the following code seems to work. Thanks!

months:2000.04m + til 12;
dates:() ,/ {select distinct DATE from trade where x=DATE.month} each
months;
> aaron.dav...@gmail.com

Aaron Davies

unread,
Feb 10, 2011, 5:47:28 PM2/10/11
to Kdb+ Personal Developers
great. if you want a little further abstraction, you could automate
the range:

q)until:{x+til 1+y-x}
q)dates:(union)over{select distinct DATE from trade where x=DATE.month}
each(until). exec(min DATE;max DATE)from trade

(or (first DATE;last DATE) if your data is sorted)
Reply all
Reply to author
Forward
0 new messages