|
1 | | -<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.453 2008/11/03 20:17:20 adunstan Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.454 2008/11/04 00:59:45 momjian Exp $ --> |
2 | 2 |
|
3 | 3 | <chapter id="functions"> |
4 | 4 | <title>Functions and Operators</title> |
@@ -12855,46 +12855,46 @@ SELECT (pg_stat_file('filename')).modification; |
12855 | 12855 |
|
12856 | 12856 | <para> |
12857 | 12857 | Currently <productname>PostgreSQL</> provides one built in trigger |
12858 | | - function, <function>suppress_redundant_updates_trigger</>, |
12859 | | - which will prevent any update |
12860 | | - that does not actually change the data in the row from taking place, in |
12861 | | - contrast to the normal behaviour which always performs the update |
12862 | | - regardless of whether or not the data has changed. (This normal behaviour |
12863 | | - makes updates run faster, since no checking is required, and is also |
12864 | | - useful in certain cases.) |
| 12858 | + function, <function>suppress_redundant_updates_trigger</>, |
| 12859 | + which will prevent any update |
| 12860 | + that does not actually change the data in the row from taking place, in |
| 12861 | + contrast to the normal behaviour which always performs the update |
| 12862 | + regardless of whether or not the data has changed. (This normal behaviour |
| 12863 | + makes updates run faster, since no checking is required, and is also |
| 12864 | + useful in certain cases.) |
12865 | 12865 | </para> |
12866 | 12866 |
|
12867 | | -<para> |
12868 | | - Ideally, you should normally avoid running updates that don't actually |
12869 | | - change the data in the record. Redundant updates can cost considerable |
12870 | | - unnecessary time, especially if there are lots of indexes to alter, |
12871 | | - and space in dead rows that will eventually have to be vacuumed. |
12872 | | - However, detecting such situations in client code is not |
12873 | | - always easy, or even possible, and writing expressions to detect |
12874 | | - them can be error-prone. An alternative is to use |
12875 | | - <function>suppress_redundant_updates_trigger</>, which will skip |
12876 | | - updates that don't change the data. You should use this with care, |
12877 | | - however. The trigger takes a small but non-trivial time for each record, |
12878 | | - so if most of the records affected by an update are actually changed, |
12879 | | - use of this trigger will actually make the update run slower. |
| 12867 | +<para> |
| 12868 | + Ideally, you should normally avoid running updates that don't actually |
| 12869 | + change the data in the record. Redundant updates can cost considerable |
| 12870 | + unnecessary time, especially if there are lots of indexes to alter, |
| 12871 | + and space in dead rows that will eventually have to be vacuumed. |
| 12872 | + However, detecting such situations in client code is not |
| 12873 | + always easy, or even possible, and writing expressions to detect |
| 12874 | + them can be error-prone. An alternative is to use |
| 12875 | + <function>suppress_redundant_updates_trigger</>, which will skip |
| 12876 | + updates that don't change the data. You should use this with care, |
| 12877 | + however. The trigger takes a small but non-trivial time for each record, |
| 12878 | + so if most of the records affected by an update are actually changed, |
| 12879 | + use of this trigger will actually make the update run slower. |
12880 | 12880 | </para> |
12881 | 12881 |
|
12882 | 12882 | <para> |
12883 | 12883 | The <function>suppress_redundant_updates_trigger</> function can be |
12884 | | - added to a table like this: |
| 12884 | + added to a table like this: |
12885 | 12885 | <programlisting> |
12886 | 12886 | CREATE TRIGGER z_min_update |
12887 | 12887 | BEFORE UPDATE ON tablename |
12888 | 12888 | FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger(); |
12889 | 12889 | </programlisting> |
12890 | 12890 | In most cases, you would want to fire this trigger last for each row. |
12891 | | - Bearing in mind that triggers fire in name order, you would then |
12892 | | - choose a trigger name that comes after the name of any other trigger |
| 12891 | + Bearing in mind that triggers fire in name order, you would then |
| 12892 | + choose a trigger name that comes after the name of any other trigger |
12893 | 12893 | you might have on the table. |
12894 | 12894 | </para> |
12895 | | -<para> |
| 12895 | +<para> |
12896 | 12896 | For more information about creating triggers, see |
12897 | | - <xref linkend="SQL-CREATETRIGGER">. |
| 12897 | + <xref linkend="SQL-CREATETRIGGER">. |
12898 | 12898 | </para> |
12899 | 12899 | </sect1> |
12900 | 12900 | </chapter> |