|
|
| Author |
Message |
rajesh_1183
Active User
Joined: 24 Nov 2005 Posts: 130 Location: Tadepalligudem
|
|
|
|
Hi all,
can any body explain what the following query performs
SELECT * FROM staff TABLESAMPLE BERNOULLI(10);
Thanks in adv,
Rajesh. |
|
| Back to top |
|
 |
References
|
|
 |
nikyojin
Active User
Joined: 05 Oct 2005 Posts: 88
|
|
|
|
Hi Rajesh,
DB2 UDB V8.1.2 adds the ability to do efficient sampling of data for SQL queries in the engine. Sampling is supported in DB2 UDB V8.1.2 with the new TABLESAMPLE clause, which is added to the FROM clause of the SQL statement. The TABLESAMPLE clause includes the approximate percentage of that table to sample, called the sampling percentage or sampling rate. For example, if the sampling rate is set to 0.1, then only 1/10 of a one percent of data will be sampled. This would mean that in a 10,000-row table, only 10 rows would be accessed ? this may or may not be appropriate for your business.
The TABLESAMPLE clause includes either the BERNOULLI or SYSTEM specification. BERNOULLI sampling examines every row to determine whether or not it is included in the answer set, while SYSTEM sampling does the sampling on a page-by-page basis. While SYSTEM sampling will be generally faster, it may result in skewed results if your calculations are based on a column that is also used for clustering the table, or for multi-dimensional organization of the data. In this case, BERNOULLI sampling may be more appropriate.
Hope this answers ur Query.... |
|
| Back to top |
|
 |
rajesh_1183
Active User
Joined: 24 Nov 2005 Posts: 130 Location: Tadepalligudem
|
|
|
|
| Thanks nikyojin |
|
| Back to top |
|
 |
|
|
|