5

OpenGeo Suite を使用して Windows 8 で PostgreSQL を実行しています。大規模な結合でディスク容量が不足しています。「ハッシュ結合一時ファイル」が保存される一時ディレクトリを変更するにはどうすればよいですか?

PostgreSQL 構成ファイルを見ていますが、tmp ファイル ディレクトリがありません。

注: 主キーに設定された可変テキスト フィールドを使用して、1,000 万行の 2 つのテーブルをマージしています。

これは私のクエリです:

UPDATE blocks 
SET "PctBlack1" = race_blocks."PctBlack1"
FROM race_blocks
WHERE race_blocks.esriid = blocks.geoid10
4

2 に答える 2

5

First, make sure you have an index on these columns (of both tables). This would make PostgreSQL use less temporary files. Also, set the GUC work_mem to as high as possible, to make PostgreSQL use more memory for operations like this.

Now, if still need, to change the temporary path, you first need to create a tablespace (if you didn't do it already):

CREATE TABLESPACE temp_disk LOCATION 'F:\pgtemp';

Then, you have to set the GUC temp_tablespaces. You can set it per database, per user, at postgresql.conf or inside the current session (before your query):

SET temp_tablespaces TO 'temp_disk';

UPDATE blocks 
SET "PctBlack1" = race_blocks."PctBlack1"
FROM race_blocks
WHERE race_blocks.esriid = blocks.geoid10

One more thing, the user must have CREATE privilege to use this:

GRANT CREATE ON TABLESPACE temp_disk TO app_user;
于 2013-09-11T01:21:49.010 に答える
0

権限がないため、PostgreSQL で直接 F:/pgtemp ディレクトリを設定できませんでした。

そのため、Windowsコマンドライン「mklink / D」(ソフトリンク)を使用してシンボリックリンクを作成しました。現在、PostgreSQL は一時ファイルを c:\Users\Administrator.opengeo\pgdata\Administrator\base\pgsql_tmp に書き込み、F: ドライブに保存します。

于 2013-09-16T02:10:48.883 に答える