Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

"TABLESAMPLE" in DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Wed Jan 04, 2006 12:38 pm    Post subject: "TABLESAMPLE" in DB2
Reply with quote

Hi all,

can any body explain what the following query performs

SELECT * FROM staff TABLESAMPLE BERNOULLI(10);

Thanks in adv,
Rajesh.
Back to top
View user's profile Send private message

nikyojin

New User


Joined: 05 Oct 2005
Posts: 94

PostPosted: Wed Jan 04, 2006 1:51 pm    Post subject: Re: "TABLESAMPLE" in DB2
Reply with quote

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
View user's profile Send private message
rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Wed Jan 04, 2006 2:59 pm    Post subject:
Reply with quote

Thanks nikyojin
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Amount field is getting corrupted whe... thesumitk SYNCSORT 5 Tue Oct 18, 2016 8:20 pm
No new posts hot to get details when "EXEC CI... Andi1982 CICS 11 Tue Sep 20, 2016 5:01 pm
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am
No new posts "DFSRRC00 vs IKJEFT01" for ... arunsoods All Other Mainframe Topics 5 Fri Aug 12, 2016 9:54 pm
No new posts Need to show date in "DYYMMDD.TH... deepak_shrivastava DFSORT/ICETOOL 2 Tue Jan 05, 2016 7:15 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us