2 `p# columns

exchsym xasc quote

`p#exch

`p#sym

Is it OK to have 2 `p# columns to speed up searches? I have sorted by exch and then by sym. Each exchange maintains its own set of symbols. Symbols from ex1 and ex2 do not overlap. Thx.

?you can add the `p attribute on exch, but it will take more memory and will not make queries faster.

given that the symbols are unique across exchanges, you only need the sym column to perform joins:

aj[symtime;t;quote]

all attributes beyond the first column of a join are ignored.

adding the `p attribute to the exch column will make the following query faster:

select from quote where exch in exch2exch2

but you won’t get any speed enhancement by filtering the quote table before the join:

aj[symtime;t] select from quote where exch in exch1exch2

filtering the quote table destroys the `p attribute that should have already existed on sym, and the resulting join will be much slower.

How do you handle multiple exchanges? Thx.

A) single table w/ the exchange column

B) multiple tables

C) multiple databases

D) multiple kdb instances

a single table is probably best.  you can include an exch column if you want (for convenience), but since each sym distinctly maps to an exch, you can create a master table with static mapping information.

its really up to you.  what problem are you experiencing with a single table that requires a `p on the exch column?