# Question on sorting a large partitioned table

**URL:** <https://forum.kx.com/t/question-on-sorting-a-large-partitioned-table/13107>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [December 4, 2023, 3:33am UTC](https://forum.kx.com/t/question-on-sorting-a-large-partitioned-table/13107 "2023-12-04T03:33:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jackyyuk1](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@jackyyuk1](https://forum.kx.com/u/jackyyuk1)\
**Post date:** [December 4, 2023, 3:33am UTC](https://forum.kx.com/t/question-on-sorting-a-large-partitioned-table/13107/1 "2023-12-04T03:33:00Z")

</div>

Hello,

Currently, I would like to sort a partitioned table by its column colA and colB. I simple perform the following actions:

{ t:`colA`colB xasc select from `:\<dir\_source\>/\<date\>/\<trade\>;

&nbsp; (`:\<dir\_destination\>/\<date\>/\<trade\>;17;2;6) set t} for each dates

However, the q service was killed occasionally due to memory usage, as some the table data is very large.

Is there anyway to reduce the memory usage, and prevent the killing?

&nbsp;

Thanks,

Jacky

---

<div class="post-metadata">

**Author:** ![fbodon1](https://avatars.discourse-cdn.com/v4/letter/f/3be4f8/32.png) [@fbodon1](https://forum.kx.com/u/fbodon1)\
**Post date:** [December 4, 2023, 2:44pm UTC](https://forum.kx.com/t/question-on-sorting-a-large-partitioned-table/13107/2 "2023-12-04T14:44:00Z")

</div>

You can sort the table column by column using iasc. This approach is described here - see function disksort.

https://code.kx.com/q/wp/intraday-writedown/#wq
