When should database synonyms be used?

aw crud picture aw crud · Mar 2, 2010 · Viewed 29.2k times · Source

I've got the syntax down but I'm wondering if somebody can provide an illustrative use case where database synonyms are very useful.

Answer

Jordan Parmer picture Jordan Parmer · Mar 2, 2010

It is excellent for staging mock tables when testing. For example, if your source tables contain millions of records and you want to test a small subset of data, you can use synonyms to re-direct the source table to a smaller table you control so you can stage various scenarios.

In this way, you can update/delete the data in the mock table without affecting your source table. When you are ready to use the source table, all you need to do is re-direct the synonym.