Re: 分類付き m_byochu

このトピックの投稿一覧へ

なし Re: 分類付き m_byochu

msg# 1.1
depth:
1
前の投稿 - 次の投稿 | 親投稿 - 子投稿.1 | 投稿日時 2010.11.30 02:19
OhYeah!  管理人   投稿数: 983 オンライン
引用:しかし、自宅 PC だとそれほど遅くないのですが、事務所の PC だと m_tekiyo への idbyochu 書き戻しに恐ろしく時間がかかります。m_sakumotsu も含めて、m_tekiyo への id 書き戻し方法は要検討です。自宅 PC では、書き戻しパターン1で 13 秒弱、パターン2で 12 秒弱、パターン3で 11 秒前後です。事務所 PC は自宅 PC の2倍近く処理時間がかかるので、パターン3なら4秒近く短縮できるかもしれませんが、焼け石に水って感じです。それに、パターン3だと、m_sakumotsu と m_byochu のいずれかのみ更新するときと、両方更新するときで処理を変えなければなりません。
ってことで、m_tekiyo に idsaku, idbyoshu を書き戻さなくてすむようにするのが一番って結論になりました

パターン1
begin transaction;
update m_tekiyo set idbyochu = (select idbyochu from m_byochu where byochu = m_tekiyo.byochu);
commit;

パターン2
create temp table if not exists t_tekiyo as select * from m_tekiyo;
begin transaction;
update t_tekiyo set idbyochu = (select idbyochu from m_byochu where byochu = t_tekiyo.byochu);
commit;
drop table if exists m_tekiyo;
create table m_tekiyo as select * from t_tekiyo;
drop table if exists t_tekiyo;

パターン3
create temp table if not exists t_tekiyo as select bango,idsaku,sakumotsu,basho,b.idbyochu as idbyochu,byochu,mokuteki,baisu,ekiryo,jiki,kaisu,hoho,jikan,ondo,dojo,chitai,tekiyaku,kaisu1,kaisu2,kaisu3,kaisu4,kaisu5 from m_tekiyo left join m_byochu as b using (byochu);
drop table if exists m_tekiyo;
create table m_tekiyo as select * from t_tekiyo;
drop table if exists t_tekiyo;
投票数:0 平均点:0.00

投稿ツリー

  条件検索へ