Database Reference
In-Depth Information
Figure 8.34
New federation member.
TASK 5: QUERYING FEDER ATED TABLE
To illustrate the efect of the splitting of a federated table, you will query the federated table
on diferent federation members. You will also query the federation metadata to reveal the
structure of the federation members. Follow the below steps to carry out the query:
1. Assume that the Query editor is still open. In the
ClassDB
pane on the left-hand
side of your screen, click the link
[ClassDB].[Class_Federation]
. Click the column
labeled
LOW
to open the context menu. Select
Query
on the context menu. hen,
select
New Query
to open the New Query editor.
2. Enter the following SQL code and click the
Run
button on the ribbon:
SELECT * FROM CLASS
3. he result of the query is shown in Figure 8.35 where the rows stored on the irst
federation member are selected. his is due to the fact that the federation key range is
(-9223372036854775808, 201199).
4. To query the federated table stored on the second federation member, in the
ClassDB
pane on the left-hand side of your screen, click the link
[ClassDB].[Class_Federation]
.
As shown in Figure 8.36, click the column labeled as
201199
to open the context menu.
5. Select
Query
on the context menu. hen, select
New Query
to open the New Query
editor. Notice that, this time, in the USE FEDERATION statement, the ClassID
starts from 201199.
6. Enter the following SQL code and click the
Run
button on the ribbon:
SELECT * FROM CLASS
7. he result of the query is shown in Figure 8.37 where the rows stored on the second
federation member are selected.
8. By setting the property FILTERING as ON in the USE FEDERATION statement,
you will have more control on what to query. For example, you can limit the range of