i have database table follows:
create table some_table ( price float not null, size float not null, retrieved datetime2 default sysutcdatetime(), runner_id int not null, foreign key (runner_id) references runner(id), primary key (retrieved, price, size, runner_id) ); create index some_table_index on some_table (runner_id);
this table populated sets of price/size data retrieved web service time-series in nature. far can tell (and have put comparison logic in code make sure) price , size never duplicated in single set of entries retrieved web service. may duplicated in subsequent requests price/size data related same runner.
i getting intermittent primary key constraint duplicate key exceptions though forming key off high resolution date time value rest of table columns. @ stage considering dropping composite key in favor of auto-generated primary key. can suggest why might happening based on table schema? consider unlikely trying insert 2 separate sets of price/size data duplicate values simultaneously given nature of code , resolution of date time value. guess possible though - using asynchronous methods interact database , web service.
thanks
is each runner_id inserting multiple rows table in bulk? it's possible same price , size processed in less 100 nanoseconds. result in them not being unique.
sql server obtains date , time values using getsystemtimeasfiletime() windows api. accuracy depends on computer hardware , version of windows on instance of sql server running. precision of api fixed @ 100 nanoseconds. accuracy can determined using getsystemtimeadjustment() windows api.
Comments
Post a Comment