calculation of table view/alias

Hi,

ich have a big table with many columns that are updated quite often. 

q)table:([id:1 2 3] quote:4 5 6;  field1: 1 2 3);

many upserts per second update the quote field.

tableview is a table alias that extends the table by some columns  that are feeded by other columns:

q)tableview::update dynamicField:quote-field1 from table

my applications now selects from this tableview, for example:

q)select from tableview where dynamicField>100

In realtity i have much more rows and much more columns that have more complicated calculations (in the view).

my question:  is it wise to build the DB like this? Performance?

how does kdb+ handle the table view/alias,  does it calculate the dynamicFields on every update (when the quote field is updated)

or is it calculated on demand when the select is issued?

when I select dynamicField > 100,    are the other dynamicFields  (i have more dynamic columns in the view) ignored or is there calculation overhead?

does the table view produce much memory overhead?

thanks! Markus

After some testing and documentation reading, I come to the conclusion that everything is only calculated when needed.

The manual at   http://code.kx.com/wiki/JB:QforMortals2/primitive\_operations#Alias\_.28Advanced.29  tells “When the alias is referenced, the underlying expression will be (re)evaluated.”

I also tested with some logging functions, here are my results:

q)a:(a:1 2 3;b:2 3 4;c:5 6 7)

q)logplus:{0N!(x;y); x+y}

q)v::update ab:logplus[a;b], bc:logplus[b;c] from a

q)select a from v where a=1;  /output logged as the fields are generated (although they are not used!)

(1 2 3;2 3 4)

(2 3 4;4 1 1)

q)select from v where a=1;  /no output!  fields are cached

q)update c:4 from `a where a=1  

`a

q)select from v where a=1;   /all fields are reevaluated, KDB seems to only invalidate the complete table

(1 2 3;2 3 4)

(2 3 4;4 1 1)

Markus