Have a separate process which subscribes to the tickerplant, sends in the quotes which it keeps a temporary copy of them. There is an aggregation table with inserts from the quote to a local process table via a +1 xbar … upsert, the problem is that need data from previous bars updated in to the aggregation table.
It was suggested to use xprev, but this loads in all previous records and only need one specific xprev, normally in SQL you would just perform an update tab1 set close=(subselect close from tab1 where sym=`GBPUSD and time=time-01:00:00) where sym=tpagg.sym and time=tpagg.time however that does not work in KDB.
What is the most efficient way to update the aggregation table with the xprev, had to stop using that as it caused 100% CPU load on low timeframes. Did consider looping each sym,time combination in the upd: but that is obviously very inefficient. Out of interest how do you determine a where exists in KDB of a compound key, and still have not found an upsert with specified columns or do you need an insert if not exists otherwise update.