A virtual column is not stored. There are two kinds of virtual columns in kdb:

  1. The index column, i, which is present in all tables, and
  2. the partition column on a partitioned table. For example, the most common partitioning scheme is by date. Rather than storing the date column along with the other columns in the table, the date is inferred from the partition directory; splayed table directories will not contain files for the date column.

See also: .Q.pf and .Q.pt

select[n]. The first example below retrieves the first 10 rows, whereas the second example retrieves the last 10 rows:

select [10] from table where date=2011.02.27
select [-10] from table where date=2011.02.27

If the table is in memory, you can use the virtual column i to retrieve a specific range of rows:

select from table where i within (begin; end)

If you want to retrieve specific rows by index from a partitioned table, use .Q.ind.

C.f. # (take) and sublist