[pgsql-jp: 39386] Q) pgpool-II について

User ken ken @ tydfam.jp
2008年 5月 11日 (日) 17:54:59 JST


  山田@町田市です。
  pgpoolについて、ここが適当なMLかどうか分かりませんが、もう一つ質問させてください。

環境: PostgreSQL 8.3.1
      pgpool-II 2.0.1
      FreeBSD-current

40テーブル程度で、其々に10から10万件のデータが入っており、データ量の多いテーブルを分割し、残りのテーブル(マスターテーブル)はreplicationという構成を意図してpostgresqlを3つ起動させている(実験なので1台のマシン-4cpu-で行っています)。

質問1)pgpool のparallel queryを id%3 で3台に振り分け、psql -p 9999 -f xxx.dbでロードしていると

ALTER TABLE
psql: xxx.db:334240: ERROR:  insert or update on table "yyyyy" violates foreign key constraint "yyyy_zzz_number_fkey"
DETAIL:  Key (zzz_number)=(19598) is not present in table "zzz".
psql: xxx.db:334248: ERROR:  kind mismatch between backends
HINT:  check data consistency between master and other db node
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
psql: xxx.db:334248: connection to server was lost

とデータの制約を加えるところでエラーが出力されます。 psql -p 9999 xxx で実際に存在しないのか調べて見ると、存在している様なので、問題無いはずなのですが、タイミングとかの問題なのでしょうか? データ量が多いので、確実な検証が出来ず、このようなエラーメッセージについては確実に原因を理解しておきたいのですが、、、。

質問2)O/Rマッピング(seam/hibernate)を使っているのですが、下のようなSQLが実行されてエラーが出ます。 select 句に含まれない物を order句に入れているのが原因の様ですが、通常のpsqlやreplication modeでは問題なく実行できます。 
また、単純に select * from xxx order by id; としても

# select * from applications order by id;
ERROR:  syntax error at or near ")"

というエラーが出ます。dist_defの定義が間違っている、といった問題なのか、原因や解決方法を教えていただければ幸いです。

出力されているSQL:
(加工すると私が混乱してしまうので、生ですが、詳細は無視してください。
結果は ERROR:  syntax error at or near "," となります。order句以下を削除して実行すると問題なく実行できます。)

select
        applicatio0_.id as id11_,
        applicatio0_.id_applicable_pesticide as id15_11_,
        applicatio0_.id_applicable_soil as id21_11_,
        applicatio0_.id_applicable_zone as id11_11_,
        applicatio0_.id_application_area as id14_11_,
        applicatio0_.id_application_method as id16_11_,
        applicatio0_.id_application_timing as id20_11_,
        applicatio0_.confirmed as confirmed11_,
        applicatio0_.id_crop as id12_11_,
        applicatio0_.id_dilution_rate as id10_11_,
        applicatio0_.expiration_date as expiration3_11_,
        applicatio0_.expired as expired11_,
        applicatio0_.flag as flag11_,
        applicatio0_.id_fumigation_duration as id19_11_,
        applicatio0_.id_fumigation_temperature as id8_11_,
        applicatio0_.id_pest as id9_11_,
        applicatio0_.id_application_purpose as id18_11_,
        applicatio0_.registration_number as registra7_11_,
        applicatio0_.id_replication as id13_11_,
        applicatio0_.url as url11_,
        applicatio0_.id_water_volume as id17_11_ 
    from
        public.applications applicatio0_,
        public.pests pests1_,
        public.crops crops2_,
        public.application_timings applicatio6_ 
    where
        applicatio0_.id_pest=pests1_.id_pest 
        and applicatio0_.id_crop=crops2_.id_crop 
        and applicatio0_.id_application_timing=applicatio6_.id_application_timing 
        and applicatio0_.id_crop in (64,173,174,175,176,504,532,554,650,679,835,979,980,1051,1089,1090,1102,1114)
        and applicatio0_.confirmed=true 
        and applicatio0_.expired=false 
        and pests1_.rank=2 
    order by
        crops2_.depth desc,
        crops2_.crop,
        pests1_.rank,
        pests1_.pest,
        applicatio6_.rank,
        applicatio0_.registration_number;



pgsql-jp メーリングリストの案内