だから私は、次のような構造を持つテーブルを持っている:SQLiteの更新クエリの最適化
TimeStamp,
var_1,
var_2,
var_3,
var_4,
var_5,...
これは、VAR _ ##という名前の約600列が含まれ、ユーザーはマシンによって保存されたいくつかのデータを解析し、私はすべてのnull値を更新する必要がありますその表の中で最後の有効な値に変更します。飼いならされたそれは、このクエリを最適化するために、どのような方法があり、すべての列のこのクエリを実行するのにかかるている今
update tableName
set var_## =
(select b.var_## from tableName as
where b.timeStamp <= tableName.timeStamp and b.var_## is not null
order by timeStamp desc limit 1)
where tableName.var_## is null;
問題:現時点では私は次のクエリを使用できますか?
UPDATEは:1列のテクエリをexecutinとき、これは、出力クエリプランです:
update wme_test2
set var_6 =
(select b.var_6 from wme_test2 as b
where b.timeStamp <= wme_test2.timeStamp and b.var_6 is not null
order by timeStamp desc limit 1)
where wme_test2.var_6 is null;
これを2つのテーブルに分割して、600のカラムテーブルを持たないようにしてください。 – AndrewK