GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||
GeezerVison is showing university.voltdb.com — @SwapTables Using VoltDB@SwapTables@SwapTables — Swaps the contents of one table for another Synopsis@SwapTables String[] table-name, String[] table-name DescriptionThe @SwapTables system procedure swaps the contents of one table for another. So, for example, if table A has 2 rows and table B has 10 rows, after executing the following system procedure call table A would have 10 rows and table B would have 2 rows: sqlcmd> exec @SwapTables 'A' 'B'; The tables being swapped must have identical schema. That is the names, datatype, and order of the columns must be the same and the tables must have the same indexes and other constraints. Also there cannot be any views on either table. If these requirements are not met, or if either of the named tables does not exist, the system procedure returns an error. The system procedure provides a significant performance advantage over any comparable SQL statements when swapping large tables because the operation does not actually move any data. The pointers for the two tables are switched, eliminating any need for excessive temporary storage or data movement. When using database replication (DR), you must pause the database before using the @SwapTables procedure, or the system procedure returns an error. The process for using @SwapTables in an XDCR environment is the following:
Return ValuesReturns one VoltTable with one row and one column.
ExamplesThe following example uses the @SwapTables system procedure to replace a lookup table of hot topics with an updated list in a single statement. sqlcmd> exec @SwapTables Hot_Topics Hot_Topics_Update; | ||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |