# Avoiding wsfull

**URL:** <https://forum.kx.com/t/avoiding-wsfull/6960>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [February 9, 2011, 10:20pm UTC](https://forum.kx.com/t/avoiding-wsfull/6960 "2011-02-09T22:20:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael1](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@Michael1](https://forum.kx.com/u/Michael1)\
**Post date:** [February 9, 2011, 10:20pm UTC](https://forum.kx.com/t/avoiding-wsfull/6960/1 "2011-02-09T22:20:00Z")

</div>

Hi everyone, I have just loaded two large splayed q databases with264361663 and 187823972 rows.The DB called trade has a DATE column and I run the querriesexec DATE from select distinct DATE from tradeexec distinct DATE from nbbowhich both give “wsfull” errors and crashes.The querry should not take a lot of memory (about 1 years worth ofdates) but I don’t know how to fix this. Could someone help?

---

<div class="post-metadata">

**Author:** ![Aaron\_Davies](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Aaron\_Davies](https://forum.kx.com/u/Aaron_Davies)\
**Post date:** [February 9, 2011, 11:45pm UTC](https://forum.kx.com/t/avoiding-wsfull/6960/2 "2011-02-09T23:45:00Z")

</div>

Possibly break it up?

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

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

---

<div class="post-metadata">

**Author:** ![trieder](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@trieder](https://forum.kx.com/u/trieder)\
**Post date:** [February 10, 2011, 12:04am UTC](https://forum.kx.com/t/avoiding-wsfull/6960/3 "2011-02-10T00:04:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![trieder](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@trieder](https://forum.kx.com/u/trieder)\
**Post date:** [February 10, 2011, 12:13am UTC](https://forum.kx.com/t/avoiding-wsfull/6960/4 "2011-02-10T00:13:00Z")

</div>

I’m curious, does this work:

{count x;.Q.PV where not 0=3D.Q.pn x}`trade

---

<div class="post-metadata">

**Author:** ![Michael1](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@Michael1](https://forum.kx.com/u/Michael1)\
**Post date:** [February 10, 2011, 8:31pm UTC](https://forum.kx.com/t/avoiding-wsfull/6960/5 "2011-02-10T20:31:00Z")

</div>

I get the following complaint:".Q.pn"On Feb 9, 7:13?pm, Tim Rieder \<trie…\> 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…\> 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?\>\> \> On Wed, Feb 9, 2011 at 5:20 PM, Michael \<princetonbac…\> wrote:\> \>\> 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?\>\> \>\> –\> \>\>

Submitted via Google Groups\</princetonbac…\>\</trie…\>\</trie…\>

---

<div class="post-metadata">

**Author:** ![Michael1](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@Michael1](https://forum.kx.com/u/Michael1)\
**Post date:** [February 10, 2011, 8:39pm UTC](https://forum.kx.com/t/avoiding-wsfull/6960/6 "2011-02-10T20:39:00Z")

</div>

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.csvLet me know if that helps.On Feb 9, 7:04?pm, Tim Rieder \<trie…\> 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?\>\>\>\> On Wed, Feb 9, 2011 at 5:20 PM, Michael \<princetonbac…\> wrote:\> \> 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?\>\> \> –\> \>

Submitted via Google Groups\</princetonbac…\>\</trie…\>

---

<div class="post-metadata">

**Author:** ![Aaron\_Davies](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Aaron\_Davies](https://forum.kx.com/u/Aaron_Davies)\
**Post date:** [February 10, 2011, 9:15pm UTC](https://forum.kx.com/t/avoiding-wsfull/6960/7 "2011-02-10T21:15:00Z")

</div>

pn is only present when a partitioned hdb has been loaded. If your  
tables are plain allayed tables, that code won’t work.

---

<div class="post-metadata">

**Author:** ![Aaron\_Davies](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Aaron\_Davies](https://forum.kx.com/u/Aaron_Davies)\
**Post date:** [February 10, 2011, 9:17pm UTC](https://forum.kx.com/t/avoiding-wsfull/6960/8 "2011-02-10T21:17:00Z")

</div>

Yeah, that’s a plain splayed table, not a partitioned table.

Did my earlier suggestion work?

---

<div class="post-metadata">

**Author:** ![Michael1](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@Michael1](https://forum.kx.com/u/Michael1)\
**Post date:** [February 10, 2011, 10:03pm UTC](https://forum.kx.com/t/avoiding-wsfull/6960/9 "2011-02-10T22:03:00Z")

</div>

Hi, the following code seems to work. Thanks!months:2000.04m + til 12;dates:() ,/ {select distinct DATE from trade where x=DATE.month} eachmonths;On Feb 10, 4:17?pm, Aaron Davies \<aaron.dav…\> wrote:\> Yeah, that’s a plain splayed table, not a partitioned table.\>\> Did my earlier suggestion work?\>\>\>\>\>\> On Thursday, February 10, 2011, Michael \<princetonbac…\> wrote:\> \> 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.\>\> \> On Feb 9, 7:04?pm, Tim Rieder \<trie…\> 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?\>\> \>\> On Wed, Feb 9, 2011 at 5:20 PM, Michael \<princetonbac…\> wrote:\> \>\> \> 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?\>\> \>\> \> –\> \>\> \>

Submitted via Google Groups\</princetonbac…\>\</trie…\>\</princetonbac…\>\</aaron.dav…\>

---

<div class="post-metadata">

**Author:** ![Aaron\_Davies](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Aaron\_Davies](https://forum.kx.com/u/Aaron_Davies)\
**Post date:** [February 10, 2011, 10:47pm UTC](https://forum.kx.com/t/avoiding-wsfull/6960/10 "2011-02-10T22:47:00Z")

</div>

great. if you want a little further abstraction, you could automatethe 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)On Feb 10, 5:03?pm, Michael \<princetonbac…\> wrote:\> 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;\>\> On Feb 10, 4:17?pm, Aaron Davies \<aaron.dav…\> wrote:\>\> \> Yeah, that’s a plain splayed table, not a partitioned table.\>\> \> Did my earlier suggestion work?\>\> \> On Thursday, February 10, 2011, Michael \<princetonbac…\> wrote:\> \> \> 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.\>\> \> \> On Feb 9, 7:04?pm, Tim Rieder \<trie…\> 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?\>\> \> \>\> On Wed, Feb 9, 2011 at 5:20 PM, Michael \<princetonbac…\> wrote:\> \> \>\> \> 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?\>\> \> \>\> \> –\> \> \>\> \>

Submitted via Google Groups\</princetonbac…\>\</trie…\>\</princetonbac…\>\</aaron.dav…\>\</princetonbac…\>
