The query results cached?
Hi guys,.I have this page that calls the same query (on a database link!) four times! First when an initial LOV is generated (and the page loads), again for an another LOV based on the original and finally for the generated report based on the 2 selections. It's insanely slow (30-40 seconds on each load ~) and also: when you try to sort a report interactive by clicking on the column name, and then queries the database again (I assumed that this part has been cached but apparently not). I so need to caching the results of an initial request and then just limit the results locally. How can I do this? Guides? Examples?
Thanks for help.
Mike
I tried this example based on a view:
CREATE MATERIALIZED VIEW MV_TEST2
REFRESH COMPLETE
START WITH SYSDATE
NEXT SYSDATE + 1/48
WITH ROWID
AS SELECT * FROM test1;
DISCOUNT COMPLETE - The complete refresh recreates together materialized view.
START WITH SYSDATE - run now
NEXT SYSDATE + 1/48 - run again in half an hour
WITH ROWID - I think that this option is important if you are using a partial refresh of the view.
AS SELECT * FROM test1; -test1 is a point of view:
CREATE OR REPLACE VIEW TEST1 AS
SELECT st_id, st_name
FROM aaw_solution_tree;
Index of the column are still possible? I do not know:
Indexing:! in regards to the MV about 10 gr 2 Jonathan Lewis wrote. ... you are allowed to create indexes on tables that sit under materialized views - just don't make them unique indexes
How much freedom is there to set the refresh rate?
What kind of discount do you need?
Another useful link: [http://asktom.oracle.com/pls/ask/search?p_string=materialized+view | http://asktom.oracle.com/pls/ask/search?p_string=materialized+view]
It will be useful.
Tobias
Tags: Database
Similar Questions
-
Today I test the query result cache, but the result is not as I expected. Please give a few advices.thank you in advance.
SQL > create table (qrc_tab)
Number 2);
Table created.
SQL > insert into qrc_tab values (1);
1 line of creation.
SQL > insert into qrc_tab values (2);
1 line of creation.
SQL > insert into qrc_tab values (3);
1 line of creation.
SQL > insert into qrc_tab 4;
1 line of creation.
SQL > insert into qrc_tab values (5);
1 line of creation.
SQL > create or replace function slow_function (p_id in qrc_tab.id%TYPE)
2 back qrc_tab.id%TYPE DETERMINISTIC AS
3 BEGIN
4 DBMS_LOCK.sleep (1);
5 return p_id;
6 end;
7.
The function is created.
SQL > set timing on
SQL > select slow_function (id) in the qrc_tab;
SLOW_FUNCTION (ID)
-----------------
1
2
3
4
5
Elapsed time: 00:00:05.01
SQL > select / * + result_cache * / slow_function (id) of qrc_tab;
SLOW_FUNCTION (ID)
-----------------
1
2
3
4
5
Elapsed time: 00:00:05.00
SQL > select / * + result_cache * / slow_function (id) of qrc_tab;
SLOW_FUNCTION (ID)
-----------------
1
2
3
4
5
Elapsed time: 00:00:05.00
SQL > select / * + result_cache * / slow_function (id) of qrc_tab;
SLOW_FUNCTION (ID)
-----------------
1
2
3
4
5
Elapsed time: 00:00:05.00
I wonder why time is not fast? Help, please
create or replace function slow_function (p_id in qrc_tab.id%TYPE)
return qrc_tab.id%TYPE result_cache DETERMINISTIC AS
Start
DBMS_LOCK. Sleep (1);
return p_id;
end;
/
--
John Watson
Oracle Certified Master s/n
-
How to get SQL Developer 4.1 to display the query result?
SQL DEV 4.0.3.16.84 execution of a SELECT statement is stored in a .sql file causes the window of the query result of pop-up indicating the result of a SELECT statement. SQL DEV 4.1 is not to do so.
Oops on my part; my SQL formatting has been the root cause. I got used to insert split without any character of comment lines in front of them. For example:
==================================================
Select funny business;
The foregoing indicates the behavior described.
--==================================================
Select funny business;
With the dash double comment shows, the SQL works very well.
This is different than previous versions of SQL Developer, but is probably better functionality. I'll try to mark it as answered, but anyone with the admin should certainly do so if I can't.
-
Need help to understand the query result
Hi gurus
I was reading one of the question here in this forum and its link is below:
I had some confusion related to this code and don't understand the logic of the out put, see query below:
Query
with sub_services as
(
Select su_seq 12323, 'HLR1' so_id, 1 seq Union double all the
Select su_seq 12323, "HLR2' so_id, seq 2 Union double all the
Select su_seq 12323, "A09" so_id, seq 3 of all the double union
Select su_seq 12333, "MO1" so_id, seq 4 Union double all the
Select su_seq 12333, "MO2' so_id, seq 5 Union double all the
Select su_seq 12333, "A09" so_id, 6 seq in union double all the
Select su_seq 12333, 'M0CR' so_id, seq 7 Union double all the
Select su_seq 12999, "LOL1' so_id, seq 8 Union double all the
Select su_seq 12999, "LOL2' so_id, seq 9 double
)
Select *.
of sub_services b
where exists (select 1 from sub_services
where su_seq = b.su_seq
and so_id = 'A09.
)
order by 2;
The query result
12323 A09 3
12333 6 A09
12323 HLR1 1
12323 HLR2 2
12333 M0CR 7
12333 4 MO1
12333 5 MO2
According to my understanding, the above query should return records in red only because of her is below command
It exists (select 1 from sub_services
where su_seq = b.su_seq
and so_id = 'A09.
but don't know why he's back 7 files, can someone help me understand the result...
It is query is functionally identical to the PL/SQL block, but much more effective.
declare
number of l_res;
Start
for line (select *)
sub_services) loop
Start
Select 1 from l_res
of sub_services
where su_seq = row.su_seq and
so_id = "A09" and
rownum = 1;
Essentially every row in the outer query are tested against him exists query. Given the correlation between two requests is based only on su_seq each line with a su_seq value returned by him is returned in the output.
Another way to think he uses instead a join condition. This query is equivalent to the query to exist
Select the main
of main sub_services
Join select (separate su_seq
of sub_services
where so_id = "A09") cond
We main.su_seq = cond.su_seq;
John
-
new to 4.02, no grid or column names in the query results
It is a bit strange, I have SQL Developer 4.02 just installed, and I don't see grid or column names in the query results. Don't see anything useful in tools > Preferences, what don't get me?
The worksheet gives you a couple of different ways to run a query...
1. instruction execute sheet icon toolbar (large green arrow, or Ctrl + Enter).
This produces a results tab of the query with the data displayed in a grid.
2. worksheet icon toolbar Execute the Script (the small tip of the green arrow on lined paper, or F5).
This produces a tab out of the Script with the data displayed on the printer.
If execution of the statement to Execute the Script, using some SQL * most orders will remove the column headers:
1. set the position
2. set the pagesize 0 (or 1 or 2).
Pagesize and linesize default is - 1. By default, the spreadsheet is free for formatting output script as he wishes. If you have not changed these settings in the spreadsheet, then see if you point to a startup script in Tools > Preferences > Database > name of the connection startup script file
Kind regards
Gary
SQL DeveloperTeam
-
Consider the function result Cache
Hello
Have a question about the function result to cache.
Follow this link: http://www.oracle.com/technetwork/articles/sql/11g-caching-pooling-088320.html
I use the following version of oracle: Oracle Database 11g Express Edition Release 11.2.0.2.0
I'm doing using the feature of function result cache.
Please find the source code used, below:
create or replace function fnresultcahceg (empid employees.employee_id%type)
employees.salary%type result_cache relies_on (employees) is back
l_salary employees.salary%type;
Start
Select the wage in l_salary of employees where employee_id = empid;
DBMS_LOCK. Sleep (1);
Return l_salary;
end fnresultcahceg;
Try to run the function created above with the following:
SQL > select fnresultcahceg (200) double;
FNRESULTCAHCEG (200)
-------------------
4400
Elapsed time: 00:00:01.15
SQL > select fnresultcahceg (201) twice;
FNRESULTCAHCEG (201)
-------------------
13000
Elapsed time: 00:00:01.01
SQL > select fnresultcahceg (200) double;
FNRESULTCAHCEG (200)
-------------------
4400
Elapsed time: 00:00:01.00
SQL > select fnresultcahceg (201) twice;
FNRESULTCAHCEG (201)
-------------------
13000
Elapsed time: 00:00:01.01
SQL > select fnresultcahceg (201) twice;
FNRESULTCAHCEG (201)
-------------------
13000
Elapsed time: 00:00:01.00
SQL > exec dbms_output.put_line (fnresultcahceg (200));
4400
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.04
SQL > exec dbms_output.put_line (fnresultcahceg (201)).
13000
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.03
SQL > exec dbms_output.put_line (fnresultcahceg (201)).
13000
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.01
SQL > exec dbms_output.put_line (fnresultcahceg (201)).
13000
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.00
SQL > exec dbms_output.put_line (fnresultcahceg (201)).
13000
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.00
SQL > exec dbms_output.put_line (fnresultcahceg (201)).
13000
PL/SQL procedure successfully completed.
Elapsed time: 00:00:01.01
SQL > spool off;
We could see no improvement in time elapsed execution.
Have a doubt on the am I missed something / do wrong to the result of the setting of the cache settings.
Have you tried with the following result cache settings
ALTER SYSTEM SET result_cache_max_size = 2M RANGE = MΘMOIRE
ALTER SYSTEM SET result_cache_remote_expiration = 2;
ALTER SYSTEM SET result_cache_mode = {MANUAL |} STRENGTH} - two similar agronomic results
The wait was to reduce the execution time after its first execution if the data remains the same.
Please guide me in this regard.
Thanks in advance,
Sandeep.S
> I use the next version of oracle: Oracle Database 11g Express Edition Release 11.2.0.2.0.
PL/SQL function result Cache is only available in Oracle Database Enterprise Edition (EE).
Concerning
-
The query results: extract all lines?
I was looking for a feature that will allow me to choose to return "all records" in the query results window. The current behavior is fetching 50 files at a time (for example fetch 50 records when you scroll the results = s-l-o-w). What I would do, that is 'Recover all lines' and then use for the scroll bar to scroll "smoothly" to the last record. For example, the 8.0.6 Query Builder version has this feature and SQL Developer 3.0, if I right click on the results. I choose 'Count lines... ". ", looks like it would be a perfect place to put an option"retrieve all rows.If your application is to be able to quickly reach the last record in a query you can press Ctrl + Page Down (with emphasis in the grid of results) and you will automatically position your view to the last record in the query automatically go get all the results in the process.
You have no need to do anything with the mouse scroll is actually the fastest way to reach the desired line.
-
Hi all
I have a question about the use of the result of the client cache but first of all, here is the information on my database:
SQL> SELECT * FROM v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for Linux: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production
I installed the Oracle Client Tools on my clientmachine. There a tnsnames.ora like this:
ORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = FEA11-119SRV)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl.local) ) )
The result of the Client Cache is configured in the sqlnet.ora.
ADR_BASE = /u01/app/oracle OCI_RESULT_CACHE_MAX_SIZE= 2048000 OCI_RESULT_CACHE_MAX_RSET_SIZE = 1024000 NAMES.DIRECTORY_PATH = (EZCONNECT, TNSNAMES, HOSTNAME)
The Databaseserver is configured like this:
SQL> col name format a30 SQL> col value format a30 SQL> SELECT name, value 2 FROM v$system_parameter 3 WHERE name LIKE '%result_cache%'; NAME VALUE ------------------------------ ------------------------------ result_cache_mode MANUAL result_cache_max_size 0 result_cache_max_result 5 result_cache_remote_expiration 0 client_result_cache_size 1073741824 client_result_cache_lag 3000
After you set up a client's server, I try the SQL query on the clientmachine followign:
sqlplus oracle/password@orcl set autotrace traceonly explain SELECT /*+ result_cache */ * FROM testtable;
-
Keep the query results set all paging
I have a query back thouands of records. For do not impact performance display and paging, which would be the best way without use of query caching? Is it possible to keep the first recordset query time she and her use in Exchange?
Load balancing definitely throws a wrinkle by using shared memory. There are ways to address these problems, but they all come with the pros and cons, just basically choose what pros like you and what the disadvantages that you can live with.
I.E. you can use sessions. So when a user first access your application, all future queries are sent to the same server that processes requests for first. But this means that if this server will see, all users currently glued to it are s.o.l.
I saw other people using databases for the persistent memory. But then, you have the LAG involved in obtaining data from the database on every request, although it should be easy fast queries to do this. Side pro, it does not matter which server processes the request.
It would be different then just re - run the original query every time, but rather store the original query results into a temporary table space so that any complexity which may exist should not be repeated.
-
Hi Experts,
I have a DB table has columns of more than 50.
I question this table, it should only return one line at any time. as sqldeveloper below image.
here, I need to build block pl/sql-query, Discover the column in the table as a key and query result as values.
Eg: Key - Value
TASK_EVENT_ID - 1765
EVENT_TYPE - ASR_UPDATE
... etc until all of the columns in my table.
Experts please comment on that point, appreciate your help on this.
Thank you
-Vincent.
Here is an approach using DBMS_SQL to iterate over the columns of key / value to assign... (Little code snipped for brevity)
create or replace procedure (task_expired)
v_store_id in full,
v_task_action_id in full,
v_job_id in full
)
as
-[SNIP code...]
v_sql VARCHAR2 (4000): = ' select * from my_table where PK = 123'; -Your SQL here!
v_v_val VARCHAR2 (4000);
v_n_val NUMBER;
v_d_val DATE;
v_ret NUMBER;
c NUMBER;
d NUMBER;
col_cnt INTEGER.
f BOOLEAN;
rec_tab DBMS_SQL. DESC_TAB;
col_num NUMBER;
vAsString VARCHAR2 (4000);
BEGIN
-[SNIP code...]
Message_properties. CORRELATION: = "EDF_EVENT";
MSG: = SYS. AQ$ _JMS_BYTES_MESSAGE. Construct();
Msg.set_string_property ('queueName', ' shipping/csi_cth');
Msg.set_string_property ('MODE', 'CR8');
c: = DBMS_SQL. OPEN_CURSOR;
DBMS_SQL. PARSE (c, v_sql, DBMS_SQL. NATIVE);
d: = DBMS_SQL. Execute (c);
DBMS_SQL. DESCRIBE_COLUMNS (c, col_cnt, rec_tab);
1.col_cnt J
LOOP
CASE rec_tab (j) .col_type
WHEN 2 THEN
DBMS_SQL. DEFINE_COLUMN (c, j, v_n_val); -Number
WHEN 12 CAN
DBMS_SQL. DEFINE_COLUMN (c, j, v_d_val); -Date
ON THE OTHER
DBMS_SQL. DEFINE_COLUMN (c, j, v_v_val, 2000); -Else treat as varchar2
END CASE;
END LOOP;
LOOP
v_ret: = DBMS_SQL. FETCH_ROWS (c);
WHEN OUTPUT v_ret = 0;
1.col_cnt J
LOOP
-Fetch each column to the correct data type based on coltype
CASE rec_tab (j) .col_type
WHEN 2 THEN
DBMS_SQL. COLUMN_VALUE (c, j, v_n_val);
vAsString: = to_char (v_n_val);
WHEN 12 CAN
DBMS_SQL. COLUMN_VALUE (c, j, v_d_val);
vAsString: = to_char (v_d_val, ' DD/MM/YYYY HH24:MI:SS');
ON THE OTHER
DBMS_SQL. COLUMN_VALUE (c, j, v_v_val);
vAsString: = v_v_val;
END CASE;
Msg.set_string_property (rec_tab (j) .col_name, vAsString);
END LOOP;
END LOOP;
DBMS_SQL. CLOSE_CURSOR (c);
DBMS_AQ. ENQUEUE (queue_name-online 'cbus.aqjms_common',
Enqueue_options => Enqueue_options,
Message_properties => Message_properties,
Payload-online msg,
Msgid => Message_handle);
dbms_output.put_line ('00 Msgid =' |) Message_handle);
dbms_output.put_line('===Done=');
-[SNIP code...]
END;
/
-
Unable to produce the query results
Hi all
Hello. I'm aunable write a query that can produce reuls froe below question. An account can have several part relationship.
Here is the data for the x table
PartyID - AcctNo - indicator - RoleCode
1111 ----- 123 ------ Y ------- 110
1112 ------- 123 ------ N --------- 120
1113 ------ 123 ------ N -------- 130
1114 ------- 124 ----- N -------- 100
1115 -------- 124 ------- N --------- 110
1116 --------- 124 ---- N --------- 100
1115 -------- 125 Y ------- 100
1116 ------- 125 N ------ 110
1117 ------- 126 Y ----- 100
Query should return these AcctNo is not any indicator = 'Y' and RoleCode did not have 100. In this case the results should be
AcctNo
123
124
Thanks in advance
Don
Hello
885137 wrote:
Hi, Frank, here is creation and insertion of table scripts. ...
Thank you.
So what's the problem with the query I posted in response #1? (You must use the correct name of the table, of course). Specify where he makes incorrect results and explain why these results are false.
-
3.1EA1: does not display the query results
The results of any query I have run in 3.1EA1 do not show in the results of the query tab. When I run sqldeveloper.exe from the command prompt, there are no errors. Sqldeveloper 3.0 is very good.
Oracle database: 10.2.0.4.0
Java version: 1.6.0_26
Operating system: Windows XP sp3 ProdThis seems to be related to read/write to the history of SQL.
You can see the question after a
delete your SQL history
or if you do not want to keep your history - zip C:\Documents and Settings\\Application Data\SQL Developer\SqlHistory folder before you delete it. Let me know.
-Rambeau -
The query results display help
Hello
I'm having a problem with the display of the results of my query result.
When I cfloop on the results... the part number was released on 3 different ranks... when I want it on a single line, querying multiple tables... and you cannot use the option to group with the cfloop
This is the query
<cfquery datasource="wire" name="testss3"> SELECT a.part AS pparts, a.wireid AS wireidA, a.strnds, a.wt, a.sps1, a.sps2, a.sps3, a.tin, b.slookup AS lid, b.wireid AS wireidB, b.reelid AS reelnmbr, d.reelid AS rlid, d.rname, d.rsku, d.rcost, e.plookupid, e.prctid, e.wireid AS wireidE, f.prctid, f.percentage, g.rsize FROM Mpart a, slookupt b, reeltbl d, prctlup e, prct f, spoolsize g WHERE a.wireid = b.wireid AND e.prctid = f.prctid AND a.wireid = e.wireid AND b.reelid = d.reelid AND g.spoolSizeid = b.spoolSizeid </cfquery> <table border="1" border="1"> <tr> <td></td> <td bgcolor="#CCCCCC" class="style23">Part No. </td> <td bgcolor="#CCCCCC" class="style23">Wt./Mft.</td> <td bgcolor="#CCCCCC" class="style23" colspan="3">Spool Sizes (Cost/ft.)</td> <td> </td> </tr> <cfloop query="testss3"><cfoutput> <tr> <td></td> <td align="left" class="style23">#pparts# @</td> <td align="left" class="style23">#wt#</td> <td align="left" class="style23"> #rsize# #rcost# #wireidA#</cfoutput></cfloop></td> <td> </td> </tr> </table>
Reference No.. M/m/Mft. Sizes in stock waiting (cost/pi) ground 10 @. 31.43 1000 2.8000 1 ground 10 @. 31.43 2500 5.9800 1 ground 10 @. 31.43 5000 7.3000 1 400A 31.43 1000 2,8000 2 400A 31.43 2500 5,9800 2 400A 31.43 5000 7,3000 2 8 ground @. 50 500 2,8000 4 8 ground @. 50 1000 5,9800 4 8 ground @. 50 5000 7,3000 4 8 T @. 50 500 2,8000 5 8 T @. 50 1000 5,9800 5 8 T @. 50 5000 7,3000 5 the first line should read 10 ground | 31.43. 1000 | 2500 | 5000
rank 10 t | 31.43. 1000 | 2500 | 5000
Any help would be appreciated!
Thank you!
You must nest CFOUTPUT tags to use the way you want. One
outside the loop to get the 'line after line only' and an inner to get all the
subdetails in this line:
roughly
-
cfdocument header does not support the query results
IN CF7, I was able to use the results of the query in the header of the document.
Now in CF8 when I try to use cfoutput content in the header either get an error (using the query variable only be #var #) or if I use the syntax #queryname.variablename # I get the first saves the information populating the header for the whole Recordset.
Example:
< cfdocument = bookmark 'pdf' format = "yes" fontembed = "no" >
< cfoutput query = "someQuery" >
< cfdocumentsection name = "#someQuery.someVar #" >
< cfdocumentitem type = "header" >
#someQuery.somevar # <-does not work!
< / cfdocumentitem >
< cfdocumentitem type = "footer" >
#cfdocument.currentpagenumber # the page <-this works
< / cfdocumentitem >
#content #.
< / cfdocumentsection >
< / cfoutput >
< / cfdocument >Hello Eric,
I tried your example with a simple query. I'm using CF8 server with "ColdFusion 8: CFDocument cumulative patch '. The last version released late January. I have no other patch on the test server. But I know it works with CHF2 or CHF3. See my attached code and try with the Cum Hot Fix CFDoc.You can be again on the forums and maybe on our site:
Here's the user forums with no regular follow-up by guaranteed Adobe. This has been the same since the days of Allaire.ColdFusion 8 hotfixes are listed in the technical note here.
Bugs can be submitted to the feature request/Bug Report Form
The Support Page of ColdFusion to the main address is www.adobe.com/support/coldfusion/. Note There are links to programs, patches, information about support plans, etc.
-
Hello
1. when I want to export the result of the query I have error ORA-00936 (missing expression). Any solution?
2. I can copy/past the result, but no title for the columns (name ot the column heading). How to make?
Thanks before.1. THE query? Sorry, I'm not psychic, but actually write to me.
2 CTRL-SHIFT-CK.
Maybe you are looking for
-
When you type in window 7, one character at a time is accepted?
I like Firefox; but I'm about to get rid of it, because it gives me the hell on the windows platform 7. It seems that it was diverting, or something. I use your last set updated. What is the solution? Benny,
-
Keep file names when exporting out of iTunes
Hello I save a lot of interviews on my iPhone, and transfer it to iTunes as a dictaphone. Now, I'm running out of space on the hard drive of my MacBook and export them on a separate hard drive. It's the Act of exporting the names of changes to a date
-
Delete attachments deletes any E-mail
MacBook Pro OSX 10.11.3 running. This used to work, but did not for the latest two OS major updates. Now, when I try to use remove attachments to mail this removes the entire email. And he disappeared without a trace, too. The email won't even be in
-
Speakers have stopped working after the flash BIOS updated for Windows 8
I had recently changed the OS of my HP Pavilion dm4t-2000 for Windows 8. After that an update of the BIOS flash me suggested by HP Support Assistant, speakers have stopped working. I tried to reinstall the Audio Codec, but it does not work. Could som
-
Question about the ultimate collection of zoo tycoon running on my laptop
Hi, ive just installed on my laptop, ultimate collection of zoo tycoon and start my computer run the application, and then a box appears which says: "a problem caused blocking the program works correctly. Windows will close the program and notify you