Synonyms
A synonym is an alternative name for an existing table, view, or sequence object. Synonyms can be created to reference tables or views in other databases, on the same database server, or on another database server.
This allows the user to write SQL that can reference a remote table without having to know the remote table syntax.
Listing 32. Example synonym
CREATE SYNONYM orders_syns for southsales@dallas:informix.orders; CREATE SYNONYM orders_synw for westsales@sanfran:informix.orders; |
The first synonym in Listing 32 points to the orders table in the southsales database on the dallas database server. The second synonym in Listing 32 points to the orders table in the westsales database on the sanfran database server.
As a user, you can join these two tables as if they were local tables in your database:
SELECT * from orders_syns, orders_synw WHERE … |
Note: Although synonyms allow ease of writing SQL code for developers, they also hide the fact that the tables being used are remote and might need more time to access, causing a slowdown in performance of the SQL statement.





