Skip to content

Searching

DRAFT

Fast searching is a key aspect of kdb+. Searching a vector is efficient and straightforward. Searching other data structures requires more care.

Q Reference: Find

Vector

q)f1k:1000{x,sum -2#x}/0 1   / first 1000 Fibonacci numbers
q)(f1k>1000000000)?1b        / ordinal of first > 1 billion
45
Where x is a vector and y of the same type, Find is right-atomic
q)type each "bad beef"?/:("a";"bc")   / returns atom and list
-7 7h

q)"bad beef"?2 4#"abcdefgh"
1 0 8 2
5 7 8 8

q)"bad beef"?("bee";("bread";"bead");"abed")
0 5 5
(0 8 5 1 2;0 5 1 2)
1 0 5 2


To do

  • Type sensitivity
  • Rank sensitivity
  • Index At
  • Tables
  • like
  • ss
  • except
  • in
  • within