随机取样:select * from XXX sample(50)

[复制链接]
查看11 | 回复1 | 2005-2-28 12:57:00 | 显示全部楼层 |阅读模式
sample这玩意到底是指什么啊
难道出多次随机取样查询出来的记录数的平均值为50%
查了半天也没有找着

回复

使用道具 举报

千问 | 2005-2-28 12:57:00 | 显示全部楼层
The sample_clause lets you instruct Oracle to select from a random sample of rows from the table, rather than from the entire
table.
BLOCK
BLOCK instructs Oracle to perform random block sampling instead of random row sampling.
See Also: Oracle8i Concepts for a discussion of the difference

sample_percent
sample_percent is a number specifying the percentage of the total row or block count to be included in the
sample. The value must be in the range .000001 to (but not including) 100.
Restrictions on the sample_clause:
You can specify SAMPLE only in a query that selects from a single table. Joins are not supported. However, you can achieve
the same results by using a CREATE TABLE ... AS SELECT query to materialize a sample of an underlying table and then rewrite
the original query to refer to the newly created table sample. If you wish, you can write additional queries to materialize
samples for other tables.
See Also: "SAMPLE Examples"
When you specify SAMPLE, Oracle automatically uses cost-based optimization. Rule-based optimization is not supported with
this clause.
Caution: The use of statistically incorrect assumptions when using this feature can lead to
incorrect or undesirable results. Refer to Oracle8i Concepts for more information on using
the sample_clause.
这是我找的,看看对你有没有帮助
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行