0
私はSQLite Database
を持っています。ここでは、次のような2つのテーブルからデータを取得します。query
。SQLite | 2つの(スキーマ)同一テーブルのデータの取得
select ie.*
from (select *
from History where Station = @station and TimeStampCome <= @till and TimeStampCome >= @from
union all
select *
from Pending where Station = @station and TimeStampCome <= @till and TimeStampCome >= @from
) ie
order by TimeStampCome desc LIMIT 100 OFFSET 1
これは最高のパフォーマンスを発揮する方法ですか?私はにalarm objects
を保存しました。したがって、100万を超えるエントリが簡単に存在する可能性があります。あなたの特定のクエリに対する
ああ、これはヒント 'indexes'です!私は、提出されたフィルタ(ステーション、から、まで)に応じてクエリを構築します。そうすれば、このような問題は発生しません。 –