Dynamic Sampling of query results
Is there a way to implement dynamic sampling of expected result set in a way that we could invoke as a percentage of expected
results?
We are using Web Intelligence XIR3SP2.
I have tested Oracle only. Teradata has a "sample" command and I would hope that Web Intelligence would use that. The Oracle method involves the dbms_random package to assign each row a random number, then the query is sorted by that number and a limit is placed for the sample size.
I have not written about this on my blog yet, but it could be an interesting topic. Thanks for the suggestion.
Similar Messages
-
How to produce dynamic cross-tab query result on this data ?
Hi gurus,
I have sales (simplified) sales data as below :
create table sales_summ (area_code varchar2(3), sales_amt number, product varchar2(10) ) ;
insert into sales_summ values ('A01', 100, 'P01');
insert into sales_summ values ('A02', 200, 'P01');
insert into sales_summ values ('B01', 300, 'P02');
insert into sales_summ values ('A01', 400, 'P02');
insert into sales_summ values ('A02', 500, 'P01');
insert into sales_summ values ('A03', 600, 'P01');
insert into sales_summ values ('A01', 700, 'P02');
insert into sales_summ values ('A02', 800, 'P02');
insert into sales_summ values ('A03', 900, 'P01');
And I want to produce a cross-tab sales summary like below :
Product A01 A02 A03 B01
P01 100 700 1500 0
P02 1100 800 0 300
How is the query ?
Thank you for your help,
xtantoSearch this forum for "pivot". Plenty of examples.
Regards,
Rob. -
Export query results to flat file with dynamic filename
Hi
Can anybody can point me how to dynamic export query serults set to for example txt file using process flows in OWB.
Let say I have simple select query
select * from table1 where daterange >= sysdate -1 and daterange < sysdate
so query results will be different every day because daterange will be different. Also I would like to name txt file dynamicly as well
eg. results_20090601.txt, results_20090602.txt, results_20090603.txt
I cant see any activity in process editor to enter custom sql statment, like it is in MSSQL 2000 or 2005
thanks in advanceYou can call existing procedures from a process flow the procedure can create the filename with whatever name you desire. OWB maps with file as target can also create a file with a dynamic name defined by an expression (see here ).
Cheers
David -
Display dynamic query result in collection
How to we put the query results in collection for a dynamic query?
Do you want to display or to store or do both.
Anyway try a check at this:
http://forum.java.sun.com/thread.jspa?threadID=584195&messageID=2991930#2991930
I think if u do the reverse process you will be able to retrieve the values from the list and display them.
Try giving a thought. -
How to get the dynamic query result
If in one query, there is the amount range dimension, based on different dimension value combination, the customer revenue should be refreshed into different range, how to make it by cube?
eg.
Customer Store Material Month Amount
C001 M & S Tennis 2005/01 "10"
C001 Douglas Tennis 2005/02 "60"
C002 M & S Soccer 2005/01 "1"
C002 M & S Soccer 2005/02 "50"
C002 M & S Tennis 2005/02 "50"
C003 Douglas Tennis 2005/01 20
Query condition:
Time Customer Amount Range Amount
2005 C001 0~50_____________0
2005 C001 51~100___________70
2005 C001 100 +____________0
2005 C002 0~50_____________0
2005 C002 51~100___________0
2005 C002 100+_____________101
2005 C003 0~50_____________20
2005 C003 51~100___________0
2005 C003 100+_____________0
However, if I drill down Time into month, the result is total different, I only list the result related to customer C001
Time Customer Amount Range Amount
2005/01 C001 0~50____________10
2005/01 C001 51~100__________0
2005/01 C001 100 +___________0
2005/02 C001 0~50____________0
2005/02 C001 51~100__________60
2005/02 C001 100 +___________0
Any good solution on that? Thanks for any input.
Message was edited by: Lei ShaoHi, Sen,
I used your solution in my infocube and query, where I created a structure with 'between'. However, it is still the simple summation in different amount range.
Just like the following:
Sales ORG / Sales Office / Sales Rep / Amount
East / Atlanta / 1001 / 3
East / Atlanta / 1002 / 4
So the query result is the same:
S-ORG / S-Office / S-Rep / Amount Range / Amount
East / Atlanta / 1001 / 0~5 / 3
East / Atlanta / 1001 / 5+ / 0
East / Atlanta / 1002 / 0~5 / 4
East / Atlanta / 1002 / 5+ / 0
When I remove 'drill down' for Sales Rep, the result is:
S-ORG / S-Office / Amount Range / Amount
East / Atlanta / 0~5 / 7
East / Atlanta / 5+ / 0
However our expection for the result is different, because in business traction, if we remove sales rep, the sales org and sales office will get the sub-total like this: (we can image it with ABAP program sub-total)
Sales ORG / Sales Office / Amount
East / Atlanta / 7
So our expection for the result is:
S-ORG / S-Office / Amount Range / Amount
East / Atlanta / 0~5 / 0
East / Atlanta / 5+ / 7
Therefore, any good suggestion for this?
Thanks a lot
Regards,
LS -
Dynamic sampling coming in the NOTE section of the explain plan.
Hi i am using 10.2.0.4.0 of oracle.
During findout the autotrace plan of one of the sql i am getting a note as '- dynamic sampling used for this statement'. So wanted to know, whether this will affect the path of execution?
below is the plan .
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | OMem | 1Mem |
|
| 1 | SORT ORDER BY | | 1 | 1 | 8 |00:00:03.77 | 8919 | 188 | 4096 | 4096 | 40
| 2 | NESTED LOOPS | | 1 | 1 | 8 |00:00:00.07 | 8919 | 188 | | |
|
| 3 | NESTED LOOPS | | 1 | 1 | 8 |00:00:00.06 | 8885 | 188 | | |
|
| 4 | NESTED LOOPS OUTER | | 1 | 1 | 8 |00:00:00.06 | 8859 | 188 | | |
|
| 5 | NESTED LOOPS OUTER | | 1 | 1 | 8 |00:00:00.06 | 8841 | 188 | | |
|
| 6 | NESTED LOOPS | | 1 | 1 | 8 |00:00:00.06 | 8839 | 188 | | |
|
| 7 | NESTED LOOPS | | 1 | 42 | 8 |00:00:00.01 | 51 | 6 | | |
| 8 | PARTITION LIST ALL | | 1 | 2716 | 8 |00:00:00.01 | 25 | 6 | | |
| 9 | TABLE ACCESS BY LOCAL INDEX ROWID| a | 12 | 2716 | 8 |00:00:00.10 | 25 | 6 | | |
|* 10 | INDEX RANGE SCAN | IDX_SPI_GRP | 12 | 2716 | 8 |00:00:00.10 | 24 | 6 | | |
|* 11 | TABLE ACCESS BY INDEX ROWID | b | 8 | 1 | 8 |00:00:00.01 | 26 | 0 | | |
|* 12 | INDEX RANGE SCAN | IDX_XMLONLINEVIEW_VENDORID | 8 | 2 | 8 |00:00:00.01 | 18 | 0 | | |
| 13 | PARTITION RANGE ALL | | 8 | 1 | 8 |00:00:03.67 | 8788 | 182 | | |
|
| 14 | PARTITION HASH ALL | | 424 | 1 | 8 |00:00:03.67 | 8788 | 182 | | |
|
|* 15 | TABLE ACCESS BY LOCAL INDEX ROWID| c | 3392 | 1 | 8 |00:00:03.66 | 8788 | 182 | | |
|
|* 16 | INDEX RANGE SCAN | IDX_UP_INVNUM_DISB | 3392 | 3 | 8 |00:00:03.55 | 8772 | 177 | | |
|
|* 17 | INDEX UNIQUE SCAN | SF_INVDISCOUNT_DISB_P1 | 8 | 1 | 0 |00:00:00.01 | 2 | 0 | | |
|* 18 | INDEX UNIQUE SCAN | P_CALCDISCNTPYMNT | 8 | 1 | 0 |00:00:00.01 | 18 | 0 | | |
| 19 | TABLE ACCESS BY INDEX ROWID | d | 8 | 1 | 8 |00:00:00.01 | 26 | 0 | | |
|* 20 | INDEX UNIQUE SCAN | PAYIDENTITY_BASE_PKI | 8 | 1 | 8 |00:00:00.01 | 18 | 0 | | |
| 21 | TABLE ACCESS BY INDEX ROWID | e | 8 | 1 | 8 |00:00:00.01 | 34 | 0 | | |
|* 22 | INDEX UNIQUE SCAN | P_INVOICESUMMARY | 8 | 1 | 8 |00:00:00.01 | 26 | 0 | | |
Note
- dynamic sampling used for this statementEdited by: 930254 on Jun 5, 2012 4:18 AM930254 wrote:
Hi i am using 10.2.0.4.0 of oracle.
During findout the autotrace plan of one of the sql i am getting a note as '- dynamic sampling used for this statement'. So wanted to know, whether this will affect the path of execution?
Note
- dynamic sampling used for this statement
It could do - you might get a different sample, which could result in different cardinality estimates, which could mean a different plan, every time you optimize this query.
On the other hand, the sampling may result in cardinality estimates that always look the same and always produce the same plan - and could even match the plan you would get after gather statistics at 100% with histograms everywhere.
Regards
Jonathan Lewis -
Hii All..
I am wondering somethings on dynamic sampling.I hope you help me.
OPTIMIZER_DYNAMIC_SAMPLING=2.
Oracle reads 32 random block on object when doing dynamic sampling after that what oracle will do ? Like ,looking data distribution on object ? looking distinct values etc ? and generate execution plan.
Please explain to me.
Best RegardsAs per Dr. Tim
Dynamic sampling enables the server to improve performance by:
* Estimate single-table predicate selectivities where available statistics are missing or may lead to bad estimations.
* Estimate statatistics for tables and indexes with missing statistics.
* Estimate statatistics for tables and indexes with out of date statistics.
Dynamic sampling is controled by the OPTIMIZER_DYNAMIC_SAMPLING parameter which accepts values from "0" (off) to "10" (agressive sampling) with a default value of "2". At compile-time Oracle determines if dynamic sampling would improve query performance. If so it issues recursive statements to estimate the necessary statistics. Dynamic sampling can be beneficial when:
* The sample time is small compared to the overall query execution time.
* Dynamic sampling results in a better performing query.
* The query may be executed multiple times. -
Pass query result as parameter to javascript
Hello,
I'm a beginner with javascript, so (maybe) sorry for this
question.
Is it possible to use a query result as parameter in a
javascript function
for example like this?
<cfquery name="select_data">
select name from user_table
</cfquery>
<script language="javascript">
function(#select_data.name#)
</script>
Background is: I have to validate an input field with some
values which are saved in a database table.
This values can be dynamic , so I don't want to put this
values into the cfm-file.
Any ideas?
ClaudiaEach column in a cf query is effectively a 1D array. You can
use the toscript function to send this array to js. -
How to use SQL query result in DOS commands
Hi
Currently i am runnig below DOS commands manually
d:\apps\bin>TrueGridsCalc period="Aug 2010"
Now I want to write one batch file and schedule job on windows and make value of "period" to be dynamic. So to get that value i need to fetch it from DB
Steps which i am taking are
1. connect DB from command line (using SQLPLUS)
2. run query to fetch result
3.How to use query result in "period" parameter ?
I am good at step 1 and 2. Dnt know how to use query result in command to make it dynamic
Thank you
Sachin
Edited by: sachin.mali on Oct 26, 2010 4:39 PM
Edited by: sachin.mali on Oct 26, 2010 4:43 PMsachin.mali wrote:
Hi
Currently i am runnig below DOS commands manually
d:\apps\bin>TrueGridsCalc period="Aug 2010"
Now I want to write one batch file and schedule job on windows and make value of "period" to be dynamic. So to get that value i need to fetch it from DB
Steps which i am taking are
1. connect DB from command line (using SQLPLUS)
2. run query to fetch result
3.How to use query result in "period" parameter ?
I am good at step 1 and 2. Dnt know how to use query result in command to make it dynamic
Thank you
Sachin
Edited by: sachin.mali on Oct 26, 2010 4:39 PM
Edited by: sachin.mali on Oct 26, 2010 4:43 PMYOu'll have to have sqlplus spool the output to a file, then figure out some way of parsing that file. Too bad you're stuck with Windows. With any *nix you could do the file parsing with one line of code. -
Strange Behavior: VO query result shown in UI different from backend
Hi Experts,
I have an issue with one of the VOs in my application. The VO uses an expert query.
The application uses ADF faces for the front end. The UI is created by dragnDrop method from ViewCriteria(Datacontrol for this VO) to the page.
I would expect the page to always show the data which I would get when I execute the query from the backend.
But the data that comes up in the UI(through the VO and queryPanel, af:table) is different from the data set if I execute the query directly from backend. (Oracle 11G Database)
The issue occurs for one set of data and not for another set of data.
I tried the following:
In VOImpl, the executeQuery method is overridden to add additional filters.
Just before super.executeQuery, captured the getQuery() result.
The query got this way, I am running from back-end(SQLPLUS/Toad) returns expected results, whereas when the Application is run, the UI table shows duplicate data for one set alone.
Please share pointers on how to debug this issue further.
Please note that this post is not about the query but I am illustrating the query here just in case its needed.
The query is something like this:
Fetch rows from maintable that belong to either the set mapping to :bindvariable1 or the set mapping to bindvariable2. This could be represented as a union between the two selects as well.
select
col1,col2,col3...
from main_table, table1, table2
where
(main_table.idcolumn =:bindvariable1
and table1.referencecolumn =:bindvariable1
and table2.referncecolumn =:bindvariable1)
or
(main_table.idcolumn =:bindvariable2
and table1.referencecolumn =:bindvariable2
and table2.referncecolumn =:bindvariable2)
and
maintable.idcolumn2=table1.idcolumn
and maintable.idcolumn3=table2.idcolumn
Thanks for your time and help.
Ganesh IyerDo you have a security policy associated with the table?
Oracle 8i supports virtual private database where the server can dynamically modify a query.
The query 'SELECT * FROM EMP' could be modified by the server to 'SELECT * FROM EMP WHERE DIVISION = 'AIRCRAFT' by putting a security policy on the EMP table.
You, as a user, would never know it happened.
A security policy based on some arcane rule such as the time of day could cause the problem you are describing.
The only other way I know of is if you logged in as two different users and each user has different privileges on the table.
Good luck!
null -
Query result in application server as a .CSV file
HI
Can any one tel me how can i place the query result in application server as a .CSV file.
when am executing WRITEQUERY program it asking query name and displaying result in excel sheet, i don't what is next step to keep file in app server.
read writequery prog,it is genrated in excel sheet, now i need to send that data to application server path in csv format
actually i am not able to get the internal table in writequry where the query data is stored.
please provide me the sample code i can understand. plz.
plz do favour for me, take this high priority and asap.
Thanks a lotHI,
Actually i don't want how to create abap querey,
My requirment is, WRITEQUERY program wherenever we r excuting it vil display qurery data in excel format,
now i don't want any excel format display, I need that data, should go to application server in .CSV format.
Actually i am not understanding writequere program, in that which internal table i have to pass application server.
PLz give me reply anyone
Help me out . -
Output query result in XML format
folks:
could anybody provide more information
about how to generate query result in
xml format? looks like DBXML is for demo only
and i have heard that PLSQL XML parser is the way to go; so far i have not found
a sample yet on how to actually
do the XML generation; if you know more
about it, please let me know; thanks in
advance.
BillHere are some sample apps that might interest you:
[list]
[*][url [URL=http://technet.oracle.com/tech/xml/xsql_servlet/index2.htm?Code&files/ffhome.html]The]http://technet.oracle.com/tech/xml/xsql_servlet/index2.htm?Code&files/ffhome.html]The XML Flight Finder
[*][url [URL=http://technet.oracle.com/sample_code/tech/xml/xmlb2b/doc/xb2bhome.html]B2B]http://technet.oracle.com/sample_code/tech/xml/xmlb2b/doc/xb2bhome.html]B2B with XML
[list]
Enjoy,
-rh -
Search criterias in one page, the query results in another page?
Hi, can I put search criterias in one page, and get query results in another page?
Need help
Thanks in advance
karmanIf you meant a situation like: Page 1 has some items and page 2 has a report which refers page 1 itemsThen your report _query would fetch proper results provided the page 1 item values are available in the session_.
That is, after submitting their values(using page submit,dynamic action,ajax etx) to session state , their values would be available in any page (anywhere in that session ) , until the page cache for the item page(page 1) is cleared. -
Create a CF Query Result Set in Java
I'd like to programatically build a ColdFusion query resultset inside of a Java class and return it to the calling application. See the Java psudocode below to see what I'm talking about:
public class MyClass {
public coldfusion.sql.QueryTable getQuery() {
// Create a query table object
QueryTable myTable = ..?
// Loop through some set of instance data for my class
for(int c = 0; c < this.myWigets.length; c++) {
int row = c+1;
myTable.setField(row, nameCol, this.myWigets[c].name);
myTable.setField(row, colorCol, this.myWigets[c].color);
return myTable;
I've had stuff like this partially working in the past but had issues with things like query of queries and such probably due to the hacks used to create the QueryTable object. I'm mainly just checking in to see if there has been any progress made in this area. To me this seems like such an obvious thing for a Java developer working within CF to want to do. I'm surprised Adobe doesn't have an officially supported API for doing this sort of thing (or maybe I'm just too dumb to find it.) A few other notes... I'm not using CFX, and I'm not starting with a java.sql.ResultSet otherwise I would use the QueryTable(java.sql.ResultSet) constructor. I need to build this thing from scratch programatically.
Thanks for your time. I hope this question makes sense to someone out there.
- MikeI appologize. I wasn't very clear with my original question.
I'm creating an instance of my Java class from within CF using createObject("java", "com.example.MyClass"). So based on the sample code in my original post on the CF side I'd like to do something like this:
<cfscript>
myObj = createObject("java", "com.example.MyClass");
myObj.doSomeStuff();
myCFQuery = myObj.getQuery(); // Return a CF query from my java class
</cfscript>
... then do stuff like ...
<cfquery name="mySortedQuery" dbtype="query">
select *
from myCFQuery
order by color
</cfquery>
I appriciate your suggestions so far. I have other solutions working already but they are not ideal. I was just hoping someone had a clean and as-hack-free-as-possible way of creating a ColdFusion query result set in Java and passing it back to CF.
Thanks again,
Mike -
All, new to Java from .NET and building a web service on a 3tier application. The client dynamically builds a query string and sends to the WS which is supposed to query the backend Oracle 10g database and return the resultset to the WS which sends back to the client. Okay, I can do simple strings just fine, but when I build the WS with a complex return type (ResultSet, Vector, String[][]) I can not get either the WS to compile or the proxy creation in JDeveloper to work. Any thoughts on how to solve this is appreciated.
Thank you for your response. How would you suggest I send the results of a SQL Query back to the client from a web service that uses JDBC to call the DB for a resultset? XML seems like a good choice, but when it gets to the client from the WS, how would I load the XML string (of the resultset) into a JTable?
Maybe you are looking for
-
i was trying to work on texteditor to code a simple html page but its not working properly like the shows only two color on the background that are green and black i dont know whats the issue but it use to work fine in mountain lion i have even tried
-
Microsoft Office 2013 and Windows 8.1
I just bought Microsoft Office Home & Business 2013 from Office Depot and tried loading the software from Microsoft's internet site and it will not load onto a new Toshiba Satellite computer I bought last December. How can I load the software onto m
-
Using XML_SECTION_GROUP within Intermedia
Hello, I wanted to use Oracle's Intermedia Text services to store XML in a CLOB. I also wanted to see if I could do the following. 1. create index only on certain elements (and not all as in a AUTO_SECTION_GROUP).Intermedia Text Manager does not allo
-
Search Update Error - Documents show in edit mode not browse mode
The following error shows in the search update job log for 450 of 2000 cards brought in, and some of the files which throw the error aren't even HTML files. They are PDFs. Error encountered while indexing cards: HTML: the number of nested tags in the
-
Recently my iMac was having problems starting up. When I turned it on, the screen would go white with blue diagonal striping and I'd have to restart. I took it to a service facility and they told me they had to replace my logic board. Total came to $