Run sql query on a different thread
Hello,
I have a swing app that queries an MS SQL database and it works fine and everything happens in the same thread. However for improved performance and to avoid freeze ups, I want the SQL queries themselves to execute on a different thread as a different class, other than the swing app class. The query results (Result Set) I want them back to my swing app so I can present them on a JTable.
Here is an example of what I am trying to accomplish:
- Press button in my swing app.
- Call class that implements Runnable
- In the Run method of the new class do the following (this code will execute in a new thread):
url = "jdbc:sqlserver://ServerName:1433;databaseName=Database;user=UserName;password=password";
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection con = DriverManager.getConnection(url);
Statement stmt;
ResultSet rs;
stmt = con.createStatement();
String queryString = "select * from databaseName";
rs = stmt.executeQuery(queryString);
con.close();
catch(Exception em){
em.printStackTrace();
JOptionPane.showMessageDialog(null,em.toString());
}- Get the ResultSet rs back from the class
- Work with the results back in my swing app and present them in the JTable
while(rs.next()){
//do some stuff
}Any help or hints are greatly appreciated.
Thanks,
Chris
Two suggestions:
-- Take a look at SwingWorker for taking care of the threading issues
-- Keep all database handling code together. Collect the records into a Collection -- most likely ArrayList -- and return that. This way you can close the Connection and RecordSet within the same method that opens them.
Just my 0.02.
db
Similar Messages
-
Executing the SQL query across 2 different databases of Oracle
Hello All,
In Microsoft SQL server we can execute following type of SQL query across 2 different databases:
select * from TEST1.dbo.GENERIC_TABLE1 union select * from TEST2.dbo.GENERIC_TABLE2;
Here TEST1 and TEST2 are 2 different databases.
Can we do the same in Oracle?yes you can, but first one has to setup a database link
Look up CREATE DATABASE LINK and then take things from there!
P; -
How to run sql query in bat file in task schedular at every 10 seconds
This is my sql script :
DECLARE @countRows INT,
@currDate DATE,
@checkForTasks INT,
@created_by_id INT,
@gst_ID int;
SET @currDate = Getdate()
SET @countRows = (SELECT Count(*)
FROM [dbo].[sd_gst_effective_table]
WHERE isapplied = 0)
IF @countRows > 0
-- Check for those GST''s who are not applied yet : if they are greater than 0 then perform next task
BEGIN
SET @checkForTasks = (SELECT Count(*)
-- Check is current date equals to task date or not
FROM [dbo].[sd_gst_effective_table]
WHERE effect_date = @currDate AND isapplied = 0)
IF @checkForTasks > 0
-- If current date = task date then perform this task
BEGIN
SET @created_by_id = (SELECT TOP 1 createdby FROM [dbo].[sd_gst_effective_table] WHERE effect_date = @currDate AND isapplied = 0)
SET @gst_ID = (SELECT gst_id FROM [dbo].[sd_gst_effective_table] WHERE effect_date = @currDate AND isapplied = 0)
-- STEP 1 :: InActivate the existing GST according to createdbyID
UPDATE sd_gst_rate
SET isactive = 0,
inactivedate = Getdate()
WHERE isactive = 1
AND createdby = @created_by_id
-- STEP 2 :: Activate the New GST according to implementation date and gstID
UPDATE sd_gst_rate
SET isactive = 1,
activedate = Getdate()
WHERE id = @gst_ID
-- STEP 3 :: Inactivate the applied GST from sd_gst_effective_table
UPDATE [dbo].[sd_gst_effective_table] SET isApplied = 1 WHERE gst_id = @gst_ID
END
END
DECLARE @Text AS VARCHAR(100)
DECLARE @Cmd AS VARCHAR(100)
DECLARE @value nvarchar(1000);
SET @value = (SELECT CONVERT(TIME,GETDATE()) AS HourMinuteSeconds);
SET @Text = 'File Writed ' + @value
SET @Cmd ='echo ' + @Text + ' > E:\AppTextFile.txt'
EXECUTE Master.dbo.xp_CmdShell @Cmd
This is resided in videos folder of windows , i have created a task schedular in windows 8.1 to run daily at every 10 seconds , but it is not working ... Please tell me how to deal with it.
Please note : This sql query is running perfectly in sql server. Query have no errors. Please check whats wrong with my time schedular. I just want my schedular to run every 10 seconds regardless of date.Hi Emad,
Is your script in a ".sql" file? May I know how you configure the schedule task action?
Since you didn't mention how you configure the schedule task, can you confirm you have followed the below step correctly?
Save your script in a ".sql" file.
Create a ".bat" file and call the sql file above inside with
sqlcmd.exe, you can reference
here.
Configure a schedule task to run the ".bat" file in a certain interval.
Have you tried to run the script in you bat file in a standalone commandline window? Please post the script in your bat file, It can help to diagnose the issue.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
Hello ,
I am using oracle 10g apex 3.2.
I have assosiated 2 schema "vpmys and vp" with one workspace.
In the application , i created a new page of report ,which is assosiated with one schema called "vp" and i wish to run this query
select * from vpmys.t_devotees
minus
select * from vp.t_devotees
Same database dmp is installed in both schema except that the no of rows may be more or less in one database.So first i need to know the added rows and what are they and then insert the same no of rows into another db.
But this doesnt run in the application.
But it runs in the SQL Command window.
So what way i should change the query so that it runs.
Thanks
SwapnaPost your question in Application Express Forum
Oracle Application Express (APEX) -
How to compare same SQL query performance in different DB servers.
We have Production and Validation Environment of Oracle11g DB on two Solaris OSs.
H/W and DB,etc configurations of two Oracle DBs are almost same in PROD and VAL.
But we detected large SQL query performace difference in PROD DB and VAL DB in same SQL query.
I would like to find and solve the cause of this situation.
How could I do that ?
I plan to compare SQL execution plan in PROD and VAL DB and index fragmentations.
Before that I thought I need to keep same condition of DB statistics information in PROD and VAL DB.
So, I plan to execute alter system FLUSH BUFFER_CACHE;
But I am worring about bad effects of alter system FLUSH BUFFER_CACHE; to end users
If we did alter system FLUSH BUFFER_CACHE; and got execution plan of that SQL query in the time end users do not use that system ,
there is not large bad effect to end users after those operations?
Could you please let me know the recomendation to compare SQL query performace ?Thank you.
I got AWR report for only VAL DB server but it looks strange.
Is there any thing wrong in DB or how to get AWR report ?
Host Name
Platform
CPUs
Cores
Sockets
Memory (GB)
xxxx
Solaris[tm] OE (64-bit)
.00
Snap Id
Snap Time
Sessions
Cursors/Session
Begin Snap:
xxxx
13-Apr-15 04:00:04
End Snap:
xxxx
14-Apr-15 04:00:22
Elapsed:
1,440.30 (mins)
DB Time:
0.00 (mins)
Report Summary
Cache Sizes
Begin
End
Buffer Cache:
M
M
Std Block Size:
K
Shared Pool Size:
0M
0M
Log Buffer:
K
Load Profile
Per Second
Per Transaction
Per Exec
Per Call
DB Time(s):
0.0
0.0
0.00
0.00
DB CPU(s):
0.0
0.0
0.00
0.00
Redo size:
Logical reads:
0.0
1.0
Block changes:
0.0
1.0
Physical reads:
0.0
1.0
Physical writes:
0.0
1.0
User calls:
0.0
1.0
Parses:
0.0
1.0
Hard parses:
W/A MB processed:
16.7
1,442,472.0
Logons:
Executes:
0.0
1.0
Rollbacks:
Transactions:
0.0
Instance Efficiency Percentages (Target 100%)
Buffer Nowait %:
Redo NoWait %:
Buffer Hit %:
In-memory Sort %:
Library Hit %:
96.69
Soft Parse %:
Execute to Parse %:
0.00
Latch Hit %:
Parse CPU to Parse Elapsd %:
% Non-Parse CPU:
Shared Pool Statistics
Begin
End
Memory Usage %:
% SQL with executions>1:
34.82
48.31
% Memory for SQL w/exec>1:
63.66
73.05
Top 5 Timed Foreground Events
Event
Waits
Time(s)
Avg wait (ms)
% DB time
Wait Class
DB CPU
0
100.00
Host CPU (CPUs: Cores: Sockets: )
Load Average Begin
Load Average End
%User
%System
%WIO
%Idle
Instance CPU
%Total CPU
%Busy CPU
%DB time waiting for CPU (Resource Manager)
Memory Statistics
Begin
End
Host Mem (MB):
SGA use (MB):
46,336.0
46,336.0
PGA use (MB):
713.6
662.6
% Host Mem used for SGA+PGA:
Time Model Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Operating System Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Operating System Statistics - Detail
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Foreground Wait Class
s - second, ms - millisecond - 1000th of a second
ordered by wait time desc, waits desc
%Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
Captured Time accounts for % of Total DB time .00 (s)
Total FG Wait Time: (s) DB CPU time: .00 (s)
Wait Class
Waits
%Time -outs
Total Wait Time (s)
Avg wait (ms)
%DB time
DB CPU
0
100.00
Back to Wait Events Statistics
Back to Top
Foreground Wait Events
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Background Wait Events
ordered by wait time desc, waits desc (idle events last)
Only events with Total Wait Time (s) >= .001 are shown
%Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
Event
Waits
%Time -outs
Total Wait Time (s)
Avg wait (ms)
Waits /txn
% bg time
log file parallel write
527,034
0
2,209
4
527,034.00
db file parallel write
381,966
0
249
1
381,966.00
os thread startup
2,650
0
151
57
2,650.00
latch: messages
125,526
0
89
1
125,526.00
control file sequential read
148,662
0
54
0
148,662.00
control file parallel write
41,935
0
28
1
41,935.00
Log archive I/O
5,070
0
14
3
5,070.00
Disk file operations I/O
8,091
0
10
1
8,091.00
log file sequential read
3,024
0
6
2
3,024.00
db file sequential read
1,299
0
2
2
1,299.00
latch: shared pool
722
0
1
1
722.00
enq: CF - contention
4
0
1
208
4.00
reliable message
1,316
0
1
1
1,316.00
log file sync
71
0
1
9
71.00
enq: CR - block range reuse ckpt
36
0
0
13
36.00
enq: JS - queue lock
459
0
0
1
459.00
log file single write
414
0
0
1
414.00
enq: PR - contention
5
0
0
57
5.00
asynch descriptor resize
67,076
100
0
0
67,076.00
LGWR wait for redo copy
5,184
0
0
0
5,184.00
rdbms ipc reply
1,234
0
0
0
1,234.00
ADR block file read
384
0
0
0
384.00
SQL*Net message to client
189,490
0
0
0
189,490.00
latch free
559
0
0
0
559.00
db file scattered read
17
0
0
6
17.00
resmgr:internal state change
1
100
0
100
1.00
direct path read
301
0
0
0
301.00
enq: RO - fast object reuse
35
0
0
2
35.00
direct path write
122
0
0
1
122.00
latch: cache buffers chains
260
0
0
0
260.00
db file parallel read
1
0
0
41
1.00
ADR file lock
144
0
0
0
144.00
latch: redo writing
55
0
0
1
55.00
ADR block file write
120
0
0
0
120.00
wait list latch free
2
0
0
10
2.00
latch: cache buffers lru chain
44
0
0
0
44.00
buffer busy waits
3
0
0
2
3.00
latch: call allocation
57
0
0
0
57.00
SQL*Net more data to client
55
0
0
0
55.00
ARCH wait for archivelog lock
78
0
0
0
78.00
rdbms ipc message
3,157,653
40
4,058,370
1285
3,157,653.00
Streams AQ: qmn slave idle wait
11,826
0
172,828
14614
11,826.00
DIAG idle wait
170,978
100
172,681
1010
170,978.00
dispatcher timer
1,440
100
86,417
60012
1,440.00
Streams AQ: qmn coordinator idle wait
6,479
48
86,413
13337
6,479.00
shared server idle wait
2,879
100
86,401
30011
2,879.00
Space Manager: slave idle wait
17,258
100
86,324
5002
17,258.00
pmon timer
46,489
62
86,252
1855
46,489.00
smon timer
361
66
86,145
238628
361.00
VKRM Idle
1
0
14,401
14400820
1.00
SQL*Net message from client
253,909
0
419
2
253,909.00
class slave wait
379
0
0
0
379.00
Back to Wait Events Statistics
Back to Top
Wait Event Histogram
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (64 msec to 2 sec)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (4 sec to 2 min)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (4 min to 1 hr)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Service Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Service Wait Class Stats
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
SQL Statistics
SQL ordered by Elapsed Time
SQL ordered by CPU Time
SQL ordered by User I/O Wait Time
SQL ordered by Gets
SQL ordered by Reads
SQL ordered by Physical Reads (UnOptimized)
SQL ordered by Executions
SQL ordered by Parse Calls
SQL ordered by Sharable Memory
SQL ordered by Version Count
Complete List of SQL Text
Back to Top
SQL ordered by Elapsed Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by CPU Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by User I/O Wait Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Gets
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Reads
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Physical Reads (UnOptimized)
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Executions
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Parse Calls
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Sharable Memory
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Version Count
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
Complete List of SQL Text
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
Instance Activity Statistics
Instance Activity Stats
Instance Activity Stats - Absolute Values
Instance Activity Stats - Thread Activity
Back to Top
Instance Activity Stats
No data exists for this section of the report.
Back to Instance Activity Statistics
Back to Top
Instance Activity Stats - Absolute Values
No data exists for this section of the report.
Back to Instance Activity Statistics
Back to Top
Instance Activity Stats - Thread Activity
Statistics identified by '(derived)' come from sources other than SYSSTAT
Statistic
Total
per Hour
log switches (derived)
69
2.87
Back to Instance Activity Statistics
Back to Top
IO Stats
IOStat by Function summary
IOStat by Filetype summary
IOStat by Function/Filetype summary
Tablespace IO Stats
File IO Stats
Back to Top
IOStat by Function summary
'Data' columns suffixed with M,G,T,P are in multiples of 1024 other columns suffixed with K,M,G,T,P are in multiples of 1000
ordered by (Data Read + Write) desc
Function Name
Reads: Data
Reqs per sec
Data per sec
Writes: Data
Reqs per sec
Data per sec
Waits: Count
Avg Tm(ms)
Others
28.8G
20.55
.340727
16.7G
2.65
.198442
1803K
0.01
Direct Reads
43.6G
57.09
.517021
411M
0.59
.004755
0
LGWR
19M
0.02
.000219
41.9G
21.87
.496493
2760
0.08
Direct Writes
16M
0.00
.000185
8.9G
1.77
.105927
0
DBWR
0M
0.00
0M
6.7G
4.42
.079670
0
Buffer Cache Reads
3.1G
3.67
.037318
0M
0.00
0M
260.1K
3.96
TOTAL:
75.6G
81.33
.895473
74.7G
31.31
.885290
2065.8K
0.51
Back to IO Stats
Back to Top
IOStat by Filetype summary
'Data' columns suffixed with M,G,T,P are in multiples of 1024 other columns suffixed with K,M,G,T,P are in multiples of 1000
Small Read and Large Read are average service times, in milliseconds
Ordered by (Data Read + Write) desc
Filetype Name
Reads: Data
Reqs per sec
Data per sec
Writes: Data
Reqs per sec
Data per sec
Small Read
Large Read
Data File
53.2G
78.33
.630701
8.9G
7.04
.105197
0.37
21.51
Log File
13.9G
0.18
.164213
41.9G
21.85
.496123
0.02
2.93
Archive Log
0M
0.00
0M
13.9G
0.16
.164213
Temp File
5.6G
0.67
.066213
8.1G
0.80
.096496
5.33
3713.27
Control File
2.9G
2.16
.034333
2G
1.46
.023247
0.05
19.98 -
All,
I'm new for sql query tuning. My select sql query is running more than 5-6 hours to complete and it is using bind variable. I'm using OEM to monitor the query. I can see stats are upto date and no blocking sessions and no object locks in db level. Can anyone guide me where I have to look and what should be done to increase the performance?
Thanks.Read FAQ: {message:id=9360003}
And {message:id=9360002} -
Help me Please ..... How to Run SQL Query in Creator
Hi all , I want to Run a SQL query in Creator how do i do it.
If i want to retrive a set of records based on few matching fields or some join conditions , what method i can use ?
How Can i run other SQL statements like ALTER , UPDATE , DROP ....
Please Help me .Hi Hanumesh,
To run SQL commands like ALTER, UPDATE, DROP you will have to go to the Pointbase console. Creator does not provide for database operations on the tables other than querying for data. To start the Pointbase console run startconsole.exe which can be found in <install directory>\SunAppServer8\pointbase\tools\serveroption.
Hope this helps
Cheers
Girish -
Running sql query across multiple (remote) databases
I'd like to run a query that pulls information from multiple databases which are not on the same machine. Is this possible using SQL Developer?
If you are still interested, there is a tool that can query multiple databases and save results in a single text file that you can then modify as necessary - see www.bsutils.com/MuSQL.html
-
Need checkbox onclick somehow to run SQL query
Hello all,
Now, I know directly I cannot do this with a javascript function. What I need to do is with a checkbox onclick
set a hidden field to the type of the data that is selected by the checkbox. So, if I select the name of a person,
the onclick method needs to let the hidden field know we have a "person" entity type. I need this type because
when I do my true submit, that form field when read will denote what next page I need to bring up in a new tab.
The question I have is ok, I can attempt to do this a couple of ways, following:
1) Come up with an AJAX call that will run a function on the server. What I do worry about is
submitting the page and ending up losing boxes that were checked. I also don't want a long
form submittal after every click.
OR
2) Forget the onclick method, create a blank .cfm form, then use that form to run the query for the
types of data, and then call the page to be displayed? Again, I'm new, so I don't know if this could
be weird in how the page comes up for display?
Thanks in advance!!!!!Hey Dan,
Yep, I'm very new at using CF, so I pretty much stink at it compared to you all. However, I fixed my one problem in that I don't need
to do anything with SQL queries with onclick. I combined a bunch of forms into one and process stuff on that page. Matter of fact,
I needed to do that.
However, what I do have a problem with is one last part of my keeping checkbox values when paging. I can do almost everything,
meaning, keep track of checkbox values when checked by having a list of those values in session. I can check the boxes when
I go back to the page with a simple <CFIF> block when the checkboxes are created for the page.
The issue I have now is how I can delete a value from the session list when a checkbox is unchecked. I don't know if I should
keep track of the exact page number, or whatnot. All I have now is a list of node ids.
Any ideas?
Thanks,
Ed -
Can we run SQL query on a XML file?
Hi All
I have an XML document which stores data of a table.
My requirement is to retreive data from this XML document by firing SQL
query.
i.e "SELECT * FROM EMP" should give me the data from the EMP.XML file
whose name is the table name.
Does Oracle provide this feature to retreive data from an XML document
by issuing the same SQL statement that is used in Database?
Any pointer for this requirement is highly appreciated.
Thanks in advance..
Ashishselect '<EMPLOYEE><EPNUM>' || EPNUM || '</EPNUM><EMPNAME>' || EMPNAME || '</EMPNAME></EMPLOYEE>' from EMPLOYEE;
-
Oracle 8i giving slow response when running sql query
hi ,
i am using oracle 8i server ;
and sql query giving slow response before some days;
so which parameter need to increase
DB_BLOCK_BFFERS OR SHARE_POOL_SIZE
CURRENT SETING IS
DB_BLOCK_BUFFER=256000;
SHARE POOLSIZE=300M;
pls advice to me
thanksNo parameters need to be increased. Tuning is not done but making arbitrary changes to values and hoping that good things will happen by accident.
The thing you really should be worrying about is your antique database and likely its impact on your skill set unless you are one year away from retirement.
Where's the actual version number?
Where's the DDL?
Where's the DML?
Where's the Explain Plan? -
Tuning (SQL Query has radically different Buffer GETS in each instance)
I have been noticing that on Node2 of my 10.2.0.3 RAC cluster CPU has been running 90% for the past couple of days and on Node1 we are at the normal 20-30%. I was comparing AWR for both instances and noticed that the same exact SQL was showing different GETS on each instance.
Both Instances are configured exactly the same. SGA 3GB, 2 dual core 1.5Ghz CPU on Solaris 10.
AWR For Node 1
SQL ordered by Gets
Resources reported for PL/SQL code includes the resources used by all SQL statements called by the code.
Total Buffer Gets: 8,199,224
Captured SQL account for 94.2% of Total
Buffer Gets Executions Gets per Exec %Total CPU Time (s) Elapsed Time (s) SQL Id SQL Module SQL Text
4,834,470 16,465 293.62 58.96 442.34 459.42 cs3w0nz7uanhc BEGIN HRW_EC_QUERY.CHECK_STUDE...
4,561,082 16,469 276.95 55.63 411.10 430.16 6vbpbvfburc4x SELECT COUNT(SECURE_PROGRAMS.P... AWR For Node 2
Buffer Gets Executions Gets per Exec %Total CPU Time (s) Elapsed Time (s) SQL Id SQL Module SQL Text
219,779,881 9,306 23,617.01 99.26 11791.62 32202.99 cs3w0nz7uanhc BEGIN HRW_EC_QUERY.CHECK_STUDE...
219,320,634 9,302 23,577.79 99.05 11760.22 32137.23 6vbpbvfburc4x SELECT COUNT(SECURE_PROGRAMS.P... Gets on Node 2 are about 45 times what they are on node 1. We are using bind variables in the SQL. The statements are completely identical. Anyone seen this before?
Thanks,
BrianAll parameters are the same between instances. Here is the result of the query.
PLAN_TABLE_OUTPUT
SQL_ID 6vbpbvfburc4x
SELECT COUNT(SECURE_PROGRAMS.PROG_ID) FROM SECURE_PROGRAMS,HRW_EC_ACTIVE_ITEM, (SELECT ACTIVE_ITEM_ID
FROM TABLE(CAST(:B1 AS HRW_EC_ACTIVE_ITEM_ID_TABLE_T)) ) T WHERE HRW_EC_ACTIVE_ITEM.ACTIVE_ITEM_ID =
T.ACTIVE_ITEM_ID AND HRW_EC_ACTIVE_ITEM.SPROG_ID = SECURE_PROGRAMS.PROG_ID AND
SECURE_PROGRAMS.STUDENT_RESOURCES_URL = :B2
Plan hash value: 25280318
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 730 (100)| |
| 1 | SORT AGGREGATE | | 1 | 57 | | |
| 2 | HASH JOIN | | 116 | 6612 | 730 (1)| 00:00:09 |
| 3 | COLLECTION ITERATOR PICKLER FETCH| | | | | |
| 4 | NESTED LOOPS | | 48596 | 2610K| 705 (1)| 00:00:09 |
| 5 | INDEX RANGE SCAN | SECURE_PROGRAMS_IDX_04 | 4 | 76 | 2 (0)| 00:00:01 |
| 6 | INDEX RANGE SCAN | HRW_EC_ACTIVE_ITEM_IDX_03 | 10984 | 386K| 176 (1)| 00:00:03 |
Query Block Name / Object Alias (identified by operation id):
1 - SEL$62A3881B
5 - SEL$62A3881B / SECURE_PROGRAMS@SEL$1
6 - SEL$62A3881B / HRW_EC_ACTIVE_ITEM@SEL$1
SQL_ID 6vbpbvfburc4x
SELECT COUNT(SECURE_PROGRAMS.PROG_ID) FROM SECURE_PROGRAMS,HRW_EC_ACTIVE_ITEM, (SELECT ACTIVE_ITEM_ID
FROM TABLE(CAST(:B1 AS HRW_EC_ACTIVE_ITEM_ID_TABLE_T)) ) T WHERE HRW_EC_ACTIVE_ITEM.ACTIVE_ITEM_ID =
T.ACTIVE_ITEM_ID AND HRW_EC_ACTIVE_ITEM.SPROG_ID = SECURE_PROGRAMS.PROG_ID AND
SECURE_PROGRAMS.STUDENT_RESOURCES_URL = :B2
Plan hash value: 219484150
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 4845 (100)| |
| 1 | SORT AGGREGATE | | 1 | 57 | | |
| 2 | HASH JOIN | | 2066 | 115K| 4845 (2)| 00:00:59 |
| 3 | INDEX RANGE SCAN | SECURE_PROGRAMS_IDX_04 | 79 | 1501 | 2 (0)| 00:00:01 |
| 4 | HASH JOIN | | 3284 | 121K| 4843 (2)| 00:00:59 |
| 5 | COLLECTION ITERATOR PICKLER FETCH| | | | | |
| 6 | INDEX FAST FULL SCAN | HRW_EC_ACTIVE_ITEM_IDX_03 | 1373K| 47M| 4803 (2)| 00:00:58 |
Query Block Name / Object Alias (identified by operation id):
1 - SEL$62A3881B
3 - SEL$62A3881B / SECURE_PROGRAMS@SEL$1
6 - SEL$62A3881B / HRW_EC_ACTIVE_ITEM@SEL$1
Note
- SQL profile "SYS_SQLPROF_014414387fd00001" used for this statement
SQL_ID 6vbpbvfburc4x
SELECT COUNT(SECURE_PROGRAMS.PROG_ID) FROM SECURE_PROGRAMS,HRW_EC_ACTIVE_ITEM, (SELECT ACTIVE_ITEM_ID
FROM TABLE(CAST(:B1 AS HRW_EC_ACTIVE_ITEM_ID_TABLE_T)) ) T WHERE HRW_EC_ACTIVE_ITEM.ACTIVE_ITEM_ID =
T.ACTIVE_ITEM_ID AND HRW_EC_ACTIVE_ITEM.SPROG_ID = SECURE_PROGRAMS.PROG_ID AND
SECURE_PROGRAMS.STUDENT_RESOURCES_URL = :B2
Plan hash value: 740005210
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 4845 (100)| |
| 1 | SORT AGGREGATE | | 1 | 57 | | |
| 2 | HASH JOIN | | 7 | 399 | 4845 (2)| 00:00:59 |
| 3 | COLLECTION ITERATOR PICKLER FETCH| | | | | |
| 4 | HASH JOIN | | 2992 | 160K| 4821 (2)| 00:00:58 |
| 5 | INDEX RANGE SCAN | SECURE_PROGRAMS_IDX_04 | 33 | 627 | 2 (0)| 00:00:01 |
| 6 | INDEX FAST FULL SCAN | HRW_EC_ACTIVE_ITEM_IDX_03 | 1373K| 47M| 4803 (2)| 00:00:58 |
Query Block Name / Object Alias (identified by operation id):
1 - SEL$62A3881B
5 - SEL$62A3881B / SECURE_PROGRAMS@SEL$1
6 - SEL$62A3881B / HRW_EC_ACTIVE_ITEM@SEL$1
Note
- SQL profile "SYS_SQLPROF_014414387fd00001" used for this statement
SQL_ID 6vbpbvfburc4x
SELECT COUNT(SECURE_PROGRAMS.PROG_ID) FROM SECURE_PROGRAMS,HRW_EC_ACTIVE_ITEM, (SELECT ACTIVE_ITEM_ID
FROM TABLE(CAST(:B1 AS HRW_EC_ACTIVE_ITEM_ID_TABLE_T)) ) T WHERE HRW_EC_ACTIVE_ITEM.ACTIVE_ITEM_ID =
T.ACTIVE_ITEM_ID AND HRW_EC_ACTIVE_ITEM.SPROG_ID = SECURE_PROGRAMS.PROG_ID AND
SECURE_PROGRAMS.STUDENT_RESOURCES_URL = :B2
Plan hash value: 1418188916
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 2136 (100)| |
| 1 | SORT AGGREGATE | | 1 | 57 | | |
| 2 | HASH JOIN | | 3 | 171 | 2136 (1)| 00:00:26 |
| 3 | NESTED LOOPS | | 1103 | 60665 | 2111 (1)| 00:00:26 |
| 4 | INDEX RANGE SCAN | SECURE_PROGRAMS_IDX_04 | 12 | 228 | 2 (0)| 00:00:01 |
| 5 | INDEX RANGE SCAN | HRW_EC_ACTIVE_ITEM_IDX_03 | 10984 | 386K| 176 (1)| 00:00:03 |
| 6 | COLLECTION ITERATOR PICKLER FETCH| | | | | |
Query Block Name / Object Alias (identified by operation id):
1 - SEL$62A3881B
4 - SEL$62A3881B / SECURE_PROGRAMS@SEL$1
5 - SEL$62A3881B / HRW_EC_ACTIVE_ITEM@SEL$1 Thanks,
Brian -
SQL Query taking the different time in Production and Development Env.
Hi All,
Following is the query which is hitting mainly two tables. SA_ORDER & AC_INVOICE.
My Production and Development both has same amount of data. But in Development env. it is just taking 5 secs. to execute but in Production Env. its handing.
I have also execution plans of both env. The difference is in development env. it is showing some view i.e. SYS.VW_NSO_1 which is not getting used in Production env.
And one more input is in Production Env, I don't have DBA privileges.
What setting will I have to make to resolve this performance problem in Production Env. ?
Here is the QUERY:------------
SELECT distinct A.GL_COMPANY_ID,
A.CUSTOMER_GROUP_ID,
A.CUSTOMER_GROUP_NAME,
A.INVOICE_ID,
A.ORDER_ID,
B.ORDER_NAME,
A.CUSTOMER_ID,
A.CUSTOMER_NAME,
c.order_name parent_order_name,
A.INVOICE_DATE,
A.DUE_DATE,
A.TOTAL_INVOICED_AMOUNT,
A.TOTAL_PAID_AMOUNT,
A.CREDITED_AMOUNT,
H.write_off
from ac_invoice a,
sa_order b,
(select parent_invoice_id, sum(total_invoiced_amount) write_off
from ac_invoice
where invoice_type_id = 3
group by parent_invoice_id) H,
(select order_id, order_name from sa_order where order_type_id in (3)) c
WHERE a.order_id = b.order_id and a.invoice_id = H.parent_invoice_id(+) and
b.parent_order_id = c.order_id(+) and
a.invoice_id NOT IN
((SELECT invoice_id
FROM ac_invoice
WHERE parent_invoice_id IS NOT NULL AND invoice_type_id != 3)
UNION
(SELECT parent_invoice_id
FROM ac_invoice
WHERE parent_invoice_id IS NOT NULL AND invoice_type_id != 3)) and
A.GL_COMPANY_ID = 1 and UPPER(A.customer_name) like upper('%KTLA%')
and
invoice_type_id in (1, 3, 4, 5, 2) and a.invoice_status_id = 1
ORDER BY A.INVOICE_IDPlease follow the advice in [url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=15]this thread for both your development and production environment.
Regards,
Rob. -
Run sql query through batch file
how to create a batch file so that on running the batch file,
I should get into the database using username and password and create the table and insert values inside that tablekindly, if you are using windows you can create 2 files as following:
a.bat
b.sql
put the files under spacific folder for example d:\bat folder
-first file a.bat will contain the following:
sqlplus apps/apps@yourdb @d:\bat\B.sql
exit
-second file b.sql will contain any sql statments you want as following:
create table a (a1 number, a2 varchar2(100))
insert into a (a1,a2) values(1,'Test')
commit
exit;
hope this help you
Regards ...
Edited by: shedo76 on 28/04/2012 03:14 ص -
How to get running SQL query 2008r2
Hi
I am faultfinding multiple slow queries initiated by SharePoint 2010 crawls.
Is there any way in SQL management studio where i can display the current running queries?
I'd love to get my hands on the queries running:P
brgs
BjornI use Adam's great utility
Who Is Active? v10.00 (2010-10-21)
(C) 2007-2010, Adam Machanic
Feedback: mailto:[email protected]
Updates: http://sqlblog.com/blogs/adam_machanic/archive/tags/who+is+active/default.aspx
"Beta" Builds: http://sqlblog.com/files/folders/beta/tags/who+is+active/default.aspx
License:
Who is Active? is free to download and use for personal, educational, and internal
corporate purposes, provided that this header is preserved. Redistribution or sale
of Who is Active?, in whole or in part, is prohibited without the author's express
written consent.
BTW http://dimantdatabasesolutions.blogspot.co.il/2008/06/how-do-you-maintain-sharepoint.html
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence
Maybe you are looking for
-
How to make a slide show or edition including mpeg and other formats
Hi, I am i bit puzzled by the use of iphoto/imovie/itunes. I have a Sony camera which generates jpg photos and mpg videos; besides, i have 3gp and mp4 videos from cell phones. Firstly, i imported all of them to iphoto. I used a automator workflow to
-
My Cluster Ready Services 10.1 (CRS) installation ran into some problem. Following are the pre-installation and installation steps which i followed. 1. The system setup involved 2 identical nodes with Windows 2000 Advanced Server SP4 OS. 2. 2 static
-
Add a Select List to a Report, for Updating a table.
I am working on Apex 3.0. I had to allow the Report could update a table. I added two checkbox to the report, and now I should add a Select List. I've tried a lot of ways but I don't know how can I pass the value selected, related to the ID of the ro
-
CS6 and Cloud Licence Not Working
I have subscribed to CS6 through the Cloud with a 1 year membership. I've downloaded all of the programs required and initially licensed them as requested. Afew day ago I was informed my "Trial" was running out. My status as a paying user is obviousl
-
Tried to print from the wedding booth app on my ipad, and the 4x6 prints cut the edges off the image. What's the fix?