]> git.8kb.co.uk Git - postgresql/pg_update_chunks/blob - README.md
Add a note after looking at older plpgsql function
[postgresql/pg_update_chunks] / README.md
1 pg_chunk_update
2 ===============
3
4 Quick and dirty pl/pgsql function to split full / large table updates into 
5 chunks and perform intermediate vacuums.
6
7 Connects via dblink to perform individual transactions.
8
9 Arguments
10 ---------
11
12         pg_chunk_update(
13                 in_nspname              -- Schema containing the table
14                 in_relname              -- Table name
15                 in_fields               -- The field names to update comma separated *
16                 in_values               -- The values for the corresponding field names *
17                 in_where_clause         -- Any where clause for the update *
18                 in_chunks               -- Break the update into this many chunks
19                 in_conninfo             -- database conninfo to pass to dblink
20         )
21
22 * Arguments for in_fields, in_values and in_where_clause are plain text and not 
23 sanitized in any way, so ensure tight permissions to prevent sql injection.
24
25 Usage
26 -----
27 For vacuum to do it's work best we should not have a long running transaction
28 in the database containing the table, so best to switch to another database:
29
30 ```sql
31 TEST=# \c postgres
32 You are now connected to database "postgres"
33 postgres=# SELECT pg_chunk_update('public', 'test', 'b', E'\'SOMETHING ELSE \' || a', 'a > 500000', 200, 'dbname=TEST user=glyn');
34 ```
35