2016-03-21 2 views
0

SQLコマンドの中で一つだけのテーブルのために立ち往生。SQLコマンドは、私は<strong>postgresの</strong>データベースを使用Djangoプロジェクトで働いていますpostgresの</p> <p>に一つだけのテーブルのために立ち往生postgresの

SQLクエリのすべてのテーブルのために働いたがの作業common_designprofilecontentテーブル

に取り組んでいない:

reader=# SELECT COUNT(*) FROM common_document; 
count 
------- 
20046 
(1 row) 

を動作していない:

reader=# SELECT COUNT(*) FROM common_designprofilecontent; 

ない結果をこのクエリから、最小20046 * 4の行がこの表にあります。次行った後


:Djangoは大きなテーブルとトリッキーなことができ

reader=# select * from pg_stat_activity; 

5:30 | 2016-03-21 10:22:27.240863+05:30 | 2016-03-21 10:22:28.614431+05:30 | t  | SELECT "common_designprofilecontent"."id", "common_designprofil 
econtent"."page_id", "common_designprofilecontent"."doc_id", "common_designprofilecontent"."profilename", "common_designprofilecontent"."profileconten 
t", "common_designprofilecontent"."page_rev_no", "common_designprofilecontent"."createdDate", "common_designprofilecontent"."createdAgent_id", "common 
_designprofilecontent"."modifiedDate", "common_designprofilecontent"."modifiedAgent_id" FROM "common_designprofilecontent" WHERE "common_designprofile 
content"."doc_id" = 26952 
16440 | reader  | 28783 |  10 | postgres | vacuumdb   |    |     |   -1 | 2016-03-19 23:37:15.579589+0 
5:30 | 2016-03-19 23:37:15.581737+05:30 | 2016-03-19 23:37:15.581737+05:30 | t  | VACUUM (FULL, ANALYZE);           



            + 

も何もログファイルに/var/log/pgsql

+1

...あなたのための最も簡単かつ最速のオプションは、カウント

x = pg_stat_activity.objects.all() x.count() 

または

len(x) 

lenが高速である使用することだろうと思いますか?ハンギング?ただ空の結果ですか?何らかの理由でフル真空が走っていると、それが物を塞ぐ可能性があります。 –

+1

postgresを再起動しても問題は再現できますか? – spicyramen

+0

@SamKuhmonen:Hanging ..私は真空については知らない。 –

答えて

0

を来ない、私は生のSQLクエリを試してみましたが、彼らはうまく機能していないように見えますdjangoで。私はあなたがいない結果とはどういう意味ですか

関連する問題