## 31.1. Publication A*publication*can be defined on any physical replication primary. The node where a publication is defined is referred to as*publisher*. A publication is a set of changes generated from a table or a group of tables, and might also be described as a change set or replication set. Each publication exists in only one database. Publications are different from schemas and do not affect how the table is accessed. Each table can be added to multiple publications if needed. Publications may currently only contain tables. Objects must be added explicitly, except when a publication is created for`ALL TABLES`. Publications can choose to limit the changes they produce to any combination of`INSERT`,`UPDATE`,`DELETE`, and`TRUNCATE`, similar to how triggers are fired by particular event types. By default, all operation types are replicated. A published table must have a “replica identity” configured in order to be able to replicate`UPDATE`and`DELETE`operations, so that appropriate rows to update or delete can be identified on the subscriber side. By default, this is the primary key, if there is one. Another unique index (with certain additional requirements) can also be set to be the replica identity. If the table does not have any suitable key, then it can be set to replica identity “full”, which means the entire row becomes the key. This, however, is very inefficient and should only be used as a fallback if no other solution is possible. If a replica identity other than “full” is set on the publisher side, a replica identity comprising the same or fewer columns must also be set on the subscriber side. See[`副本身份`](sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY)有关如何设置副本标识的详细信息。如果将没有副本标识的表添加到复制的发布中`更新`要么`删除`随后的操作`更新`要么`删除`操作将导致发布者出错。`插入`无论任何副本身份如何,操作都可以继续进行。 每个发布都可以有多个订阅者。 发布是使用[`创建出版物`](sql-createpublication.html)命令,以后可以使用相应的命令进行更改或删除。 可以使用动态添加和删除各个表[`更改出版物`](sql-alterpublication.html).这俩`添加表格`和`删除表`操作是事务性的;因此一旦事务提交,表将在正确的快照处开始或停止复制。