Help With Geodetic Rectangular Query Please
I'm new to spatial so I appreciate your help.
I have a 3D geodetic coordinate system defined that is index in 2D (lon & lat).
I want to do a query that returns all points (lat, lon, alt) within the rectangle described by the query.
I read in the "Oracle Spatial User's Guide" that this rectangle must have 5 points (since I'm using geodetic).
I have not found a good example of how to format the query. Can you help with an example?
here is an example which assume a wgs-84 coordinate system (srid=8307). Note that altitude will be ignored.
select col1,col2,etc
from geom_table
where sdo_relate(geom,mdsys.sdo_geometry(2003,8307,NULL,
mdsys.sdo_elem_info_array(1,1003,1),
mdsys.sdo_ordinate_array(-70.05,40.8, -69.05,40.8, -69.05,41.2, -70.05,41.2, -70.05,40.8)),
'mask=anyinteract querytype=window') = 'TRUE';
Similar Messages
-
Help with report script query please
Hi,
I'm trying to write a report script with a slight calculation and would really appreciate some help.
Ideally I want to create a report where I only get the Account and Value. I select all my members but I need a calculation on the Entity dimension. Here's what i am trying to achieve:
(All selected members for all Entities + All selected members for all Entities in group RIA-IFRS REPORTING ADJS. ) Yes I'm duplicating the members of group RI-IFRS REPORTING ADJS.
So account 100 for all Entities = 50
account 100 for all Entities in RI-IFRS REPORTING ADJS. = 25
I want to display account 100 grouped as 75 without showing a line for each entity.
This is what I have so far but it doesn't work right:
ROWREPEAT
SUPCOLHEADING
SUPCOMMAS
SUPHEADING
SUPBRACKETS
SUPEMPTYROWS
TABDELIMIT
MISSINGTEXT "#mi"
DECIMAL 2
NOINDENTGEN
<PAGE ( Years, Version, Currency, Scenario, InterCompany, "Entity", "Cost Center","Set of Books","Reporting")
"FY10" "Current" "Currency" "Actual" "InterCompany" "Entity" "Cost Center" "AB_CON_USD" "Reporting"
<ROW ("Account")
<LINK(<DESCENDANTS("Total Balance Sheet Accounts","Lev0,Account"))
{ CALCULATE ROW "Entity" = "Entity" + "RI-IFRS REPORTING ADJS."})
<COL (Period)
"Dec"
!For the benefit of anyone else looking for this answer, I figured it out.
//To do this it's better to create 2 columns:
<COLUMN (Period)
Q4
WWL "RIA-IFRS REPORTING ADJS."
//Then add the 2 columns up:
CALCULATE COLUMN "Q4 Gaap" = 1 - 2
//And order the column how you want
ORDER 0,3,1,2
Hope this help someone out.
http://atmyplace.co.uk -
Help with this SQL Query please
How many garments has each dressmaker constructed? You should give the number of garments and the name, house number and post code of each dressmaker.
tables; dressmaker contains D_NO, D_NAME, D_HOUSE_NO, D_POST_CODE
garment contains STYLE_NO, DESCRIPTION, LABOUR_COST, NOTIONS
quantities contains STYLE_Q, SIZE_Q, QUANTITY
The question title is multitableJOINS
I believe i have to use (garment.style_no=quantities.style_q) if it will work, im new to oracle & SQL so all the help i get i am grateful for, thankyou.Not to be a jerk, but this forum is really not intended for homework. Show a little effort, and try it out. Post some results, and maybe someone will help you out. Getting others to do your homework will not help you when you get out of school.
-
Need some help with the Select query.
Need some help with the Select query.
I had created a Z table with the following fields :
ZADS :
MANDT
VKORG
ABGRU.
I had written a select query as below :
select single vkorg abgru from ZADS into it_rej.
IT_REJ is a Work area:
DATA : BEGIN OF IT_REJ,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
This is causing performance issue. They are asking me to include the where condition for this select query.
What should be my select query here?
Please suggest....
Any suggestion will be apprecaiated!
Regards,
DeveloperHello Everybody!
Thank you for all your response!
I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
I had created a Z table with the following fields :
ZADS :
MANDT
VKORG
ABGRU.
I had written a select query as below :
I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table
select vkorg abgru from ZADS into it_rej.
Earlier :
IT_REJ is a Work area:
DATA : BEGIN OF IT_REJ,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
Now :
DATA : BEGIN OF IT_REJ occurs 0,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
I guess this will fix the issue correct?
PLease suggest!
Regards,
Developer. -
Help with an SQL Query on the Logger
We are running UCCE 8.5(3) and need help with an SQL query. When I run the below I would also like to see skill group information(name preferably)? Any help would be greatly appreciated!
select * from dbo.t_Termination_Call_Detail where DateTime between '10-11-2012 00:00:00:00' and
'10-11-2012 23:59:59:59'David, thanks for replying. Unfortunitly I don't know enough about SQL to put that into a query and have it return data. Would you be able to give an example on what the query would look like?
-
Here is my code , i dont have any experience with writing the nested sql , i got the below code , which needs to be modified adding a case statement which will show util_rate for 2 conditions
1. given in where condition ( to_char(time_stamp,'HH24') >= '09' and to_char(time_stamp,'HH24') <= '19')
2.Apposite to the condition above (to_char(time_stamp,'HH24') < '09'and to_char(time_stamp,'HH24') > '19')
could anybody please help me in adding the 2nd condition to the below query , please share any documentation you have for learning how to write nested sql,
Thank you
select device,time_stamp,
sum(ActiveHRS)/sum(AvailHRS) as RATE
from
select device,time_stamp,
case when usage >0 then 1
else 0 end as ActiveHRS,
'1' as AvailHRS
from
select device,time_stamp,
sum(case
when state = 9 then 0
when state = 0 then 0
else 1 end) as usage
from A
where to_char(time_stamp,'HH24') >= '09'
and to_char(time_stamp,'HH24') <= '19'
and to_char(time_stamp, 'D') in (2,3,4,5,6)
group by device, time_stamp
group by device,time_stampHere is the DDL :
desc rumi_all
Name Null Type
RUMI_DEVICE VARCHAR2(20)
STATE NUMBER(38)
TIME_STAMP DATE
LOCATION VARCHAR2(50) Here is some sample data :
RUMI_DEVICE STATE TIME_STAMP LOCATION
10.45.28.86 0 15-JUN-10 WA-102
10.45.28.51 0 15-JUN-10 WA-102
10.45.28.63 0 15-JUN-10 WA-102
10.45.29.47 9 15-JUN-10 WA-120I used the below query to get the util for the hours 9am - 7pm
select rumi_device,time_stamp,
sum(ActiveHRS)/sum(AvailHRS) as RATE
from
select rumi_device,time_stamp,
case when usage >0 then 1
else 0 end as ActiveHRS,
'1' as AvailHRS
from
select rumi_device,time_stamp,
sum(case
when state = 9 then 0
when state = 0 then 0
else 1 end) as usage
from rumi_all
where to_char(time_stamp,'HH24') >= '09'
and to_char(time_stamp,'HH24') <= '19'
and to_char(time_stamp, 'D') in (2,3,4,5,6)
group by rumi_device, time_stamp
group by rumi_device,time_stamp
Acquired Out for the above query :
RUMI_DEVICE TIME_STAMP UTIL_RATE
10.45.29.47 15-JUN-10 0.234
10.45.28.63 15-JUN-10 0.123
10.45.29.47 15-JUN-10 0.987
10.45.29.47 16-JUN-10 0.23Desired output :I want 2 extra columns which shows util rate for the above condition i.e 9am - 7pm(core hours) and also opposite to that condition after 7pm - before 9am(say, non core hours)
Desired out put :
RUMI_DEVICE TIME_STAMP Core_Util_Rate Non_Core_UtilRate
10.45.29.4 15-JUN-10 0.234 0.003
10.45.28.63 15-JUN-10 0.123 0.001
10.45.29.47 15-JUN-10 0.987 0.023
10.45.29.47 16-JUN-10 0.23 0Hope this helps in answering my question , and also could you please share some document to learn writing nested sql's , i always had tough time in understanding this :-( -
Hi,
I have another query running slow when executed from cognos. It is also not returning any output continues to execute,
with "Union15" as (
select distinct CASE WHEN(substr(to_char(FLOOR("EES_ENERGY_MASTER"."DISC_MON"/100)), 1, 4) IS NULL) OR (case substr(to_char(FLOOR("EES_ENERGY_MASTER"."DISC_MON"/100)), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end IS NULL) THEN NULL ELSE (substr(to_char(FLOOR("EES_ENERGY_MASTER"."DISC_MON"/100)), 1, 4)||case substr(to_char(FLOOR("EES_ENERGY_MASTER"."DISC_MON"/100)), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end ) END "QUARTER", "EES_ENERGY_MASTER"."PAT_KEY" "Cases_Using_Energy", 0 "Total_Cases"
from "MDM_DBA"."EES_ENERGY_MASTER" "EES_ENERGY_MASTER", "MDM_DBA"."EES_CONS_PROV" "EES_CONS_PROV"
where "EES_ENERGY_MASTER"."DISC_MON">=2006101 and "EES_ENERGY_MASTER"."PDCT_CAT"='Energy' and substr("EES_ENERGY_MASTER"."ICD_CODE", 1, 2)='68-gyn' and "EES_ENERGY_MASTER"."MANUFACTURER"='EES' and "EES_CONS_PROV"."CONS_06_09_YN" in ('N', 'Y') and "EES_ENERGY_MASTER"."PROV_ID"="EES_CONS_PROV"."PROV_ID" union
select CASE WHEN(substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 1, 4) IS NULL) OR (case substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end IS NULL) THEN NULL ELSE (substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 1, 4)||case substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end ) END "QUARTER", 0 "Cases_Using_Energy", count("MVW_EES_ICD_STATS"."CASES") "Total_Cases"
from "MDM_DBA"."MVW_EES_ICD_STATS" "MVW_EES_ICD_STATS", "MDM_DBA"."EES_CONS_PROV" "EES_CONS_PROV", "MDM_DBA"."EES_HOSP_CHG_PROV" "EES_HOSP_CHG_PROV"
where "MVW_EES_ICD_STATS"."DISC_QTR">=20061 and "MVW_EES_ICD_STATS"."ICD_GROUP"='68-gyn' and "EES_CONS_PROV"."CONS_06_09_YN" in ('N', 'Y') and "EES_HOSP_CHG_PROV"."PDCT_CAT"='Energy' and "EES_HOSP_CHG_PROV"."MANUFACTURER"='EES' and "MVW_EES_ICD_STATS"."PROV_ID"="EES_CONS_PROV"."PROV_ID" and "MVW_EES_ICD_STATS"."PROV_ID"="EES_HOSP_CHG_PROV"."PROV_ID"
group by CASE WHEN(substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 1, 4) IS NULL) OR (case substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end IS NULL) THEN NULL ELSE (substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 1, 4)||case substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end ) END)
select "T1"."C0" "levelkey", "T1"."C1" "Cases_Using_Energy", "T0"."C0" "Cases_Using_Energy1", "T1"."C2" "Total_Cases"
from (
select count(distinct "Union15"."Cases_Using_Energy") "C0"
from "Union15") "T0", (
select "Union15"."QUARTER" "C0", count(distinct "Union15"."Cases_Using_Energy") "C1", sum("Union15"."Total_Cases") "C2"
from "Union15"
group by "Union15"."QUARTER") "T1"The explain plan is as follows,
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost |
| 0 | SELECT STATEMENT | | 1 | 50 | | 22 |
| 2 | TEMP TABLE TRANSFORMATION | | | | | |
| 1 | RECURSIVE EXECUTION | SYS_LE_2_0 | | | | |
| 0 | INSERT STATEMENT | | 3053 | 128K| | 1372 |
| 1 | LOAD AS SELECT | | | | | |
| 2 | SORT UNIQUE | | 3053 | 128K| 376K| 1372 |
| 3 | UNION-ALL | | | | | |
|* 4 | HASH JOIN | | 3052 | 128K| | 185 |
|* 5 | TABLE ACCESS FULL | EES_CONS_PROV | 622 | 3732 | | 2 |
|* 6 | TABLE ACCESS BY INDEX ROWID | EES_ENERGY_MASTER | 3055 | 110K| | 182 |
|* 7 | INDEX RANGE SCAN | IDX_ENERGY_PDCT_CAT | 1978 | | | 2478 |
| 8 | SORT GROUP BY | | 1 | 40 | | 1160 |
|* 9 | TABLE ACCESS BY INDEX ROWID | EES_HOSP_CHG_PROV | 4 | 72 | | 1 |
| 10 | NESTED LOOPS | | 1 | 40 | | 1157 |
| 11 | NESTED LOOPS | | 1 | 22 | | 1156 |
|* 12 | TABLE ACCESS BY INDEX ROWID| MVW_EES_ICD_STATS | 1 | 16 | | 1155 |
|* 13 | INDEX RANGE SCAN | MVWICDSTATS_DISCQTR_IDX | 13M| | | 26068 |
|* 14 | TABLE ACCESS BY INDEX ROWID| EES_CONS_PROV | 1 | 6 | | 1 |
|* 15 | INDEX UNIQUE SCAN | EES_CONS_PROV_PK | 1 | | | |
|* 16 | INDEX RANGE SCAN | PROV_ID_IDX_2 | 65 | | | 1 |
| 3 | MERGE JOIN CARTESIAN | | 1 | 50 | | 22 |
| 4 | VIEW | | 1 | 13 | | 3 |
| 5 | SORT GROUP BY | | 1 | 13 | | |
| 6 | VIEW | | 3053 | 39689 | | 3 |
| 7 | TABLE ACCESS FULL | SYS_TEMP_0FD9D68B3_C112F95D | 3053 | 110K| | 3 |
| 8 | VIEW | | 1 | 37 | | 19 |
| 9 | SORT GROUP BY | | 1 | 37 | | 19 |
| 10 | VIEW | | 3053 | 110K| | 3 |
| 11 | TABLE ACCESS FULL | SYS_TEMP_0FD9D68B3_C112F95D | 3053 | 110K| | 3 |
Predicate Information (identified by operation id):
4 - access("EES_ENERGY_MASTER"."PROV_ID"="EES_CONS_PROV"."PROV_ID")
5 - filter("EES_CONS_PROV"."CONS_06_09_YN"='N' OR "EES_CONS_PROV"."CONS_06_09_YN"='Y')
6 - filter("EES_ENERGY_MASTER"."DISC_MON">=2006101 AND SUBSTR("EES_ENERGY_MASTER"."ICD_CODE",1,2)='68-gyn'
AND "EES_ENERGY_MASTER"."MANUFACTURER"='EES')
7 - access("EES_ENERGY_MASTER"."PDCT_CAT"='Energy')
9 - filter("EES_HOSP_CHG_PROV"."PDCT_CAT"='Energy' AND "EES_HOSP_CHG_PROV"."MANUFACTURER"='EES')
12 - filter("MVW_EES_ICD_STATS"."ICD_GROUP"='68-gyn')
13 - access("MVW_EES_ICD_STATS"."DISC_QTR">=20061 AND "MVW_EES_ICD_STATS"."DISC_QTR" IS NOT NULL)
14 - filter("EES_CONS_PROV"."CONS_06_09_YN"='N' OR "EES_CONS_PROV"."CONS_06_09_YN"='Y')
15 - access("MVW_EES_ICD_STATS"."PROV_ID"="EES_CONS_PROV"."PROV_ID")
16 - access("MVW_EES_ICD_STATS"."PROV_ID"="EES_HOSP_CHG_PROV"."PROV_ID")
Please help with some solution.OK: the third parameter of the SUBSTR function indicates the (maximum) length of the returnd string.
Therefore SUBSTR("EES_ENERGY_MASTER"."ICD_CODE",1,2) could possibly be '68' , but never '68-gyn'.
'68-gyn' is just 4 characters too long.
Urs -
Need some help with the colour profile please. Urgent! Thanks
Dear all, I need help with the colour profile of my photoshop CS6.
I've taken a photo with my Canon DSLR. When I opened the raw with ACDSee, the colour looks perfectly ok.
So I go ahead and open in photoshop. I did nothing to the photo. It still looks ok
Then I'm prompt the Embedded Profile Mismatch error. I go ahead and choose Discard the embedded profile option
And the colour started to get messed up.
And the output is a total diasater
Put the above photo side by side with the raw, the red has became crimson!!
So I tried the other option, Use the embedded profile
The whole picture turns yellowish in Photoshop's interface
And the output is just the same as the third option.
Could someone please guide me how to fix this? Thank you.I'm prompt the Embedded Profile Mismatch error. I go ahead and choose Discard the embedded profile option
always use the embedded profile when opening tagged images in Photoshop - at that point Photoshop will convert the source colors over to your monitor space correctly
if your colors are wrong at that point either your monitor profile is off, or your source colors are not what you think they are - if other apps are displaying correctly you most likely have either a defective monitor profile or source profile issues
windows calibrate link:
http://windows.microsoft.com/en-US/windows7/Calibrate-your-display
for Photoshop to work properly, i recall you want to have "use my settings for this device" checked in Color Management> Device tab
you may want to download the PDI reference image to check your monitor and print workflows
and complete five easy steps to profile enlightenment in Photoshop
with your settings, monitor profile and source profiles sorted out it should be pretty easy to pinpoint the problem... -
Help with Inner Join query in SQL
Hope someone can help with this, as this is quite an involved project for me, and I'm just about there with it.
My table structure is :
table_packages
packageID
package
packageDetails
etc
table_destinations
destinationID
destination
destinationDetails
etc
table_packagedestinations
packageID
destinationID
..so nothing that complicated.
So the idea is that I can have a package details page which shows the details of the package, along any destinations linked to that package via the packagedestinations table.
So this is the last part really - to get the page to display the destinations, but I'm missing something along the way....
This is the PHP from the header, including my INNER JOIN query....
PHP Code:
<?php
$ParampackageID_WADApackages = "-1";
if (isset($_GET['packageID'])) {
$ParampackageID_WADApackages = (get_magic_quotes_gpc()) ? $_GET['packageID'] : addslashes($_GET['packageID']);
$ParamSessionpackageID_WADApackages = "-1";
if (isset($_SESSION['WADA_Insert_packages'])) {
$ParamSessionpackageID_WADApackages = (get_magic_quotes_gpc()) ? $_SESSION['WADA_Insert_packages'] : addslashes($_SESSION['WADA_Insert_packages']);
$ParampackageID2_WADApackages = "-1";
if (isset($_GET['packageID'])) {
$ParampackageID2_WADApackages = (get_magic_quotes_gpc()) ? $_GET['packageID'] : addslashes($_GET['packageID']);
mysql_select_db($database_connPackages, $connPackages);
$query_WADApackages = sprintf("SELECT packageID, package, costperpax, duration, baselocation, category, dateadded, agerange, hotel, educational_tours, field_trips, corporate_outings, plant_visits, budget_package, rollingtours, teambuilding, description, offer FROM packages WHERE packageID = %s OR ( -1= %s AND packageID= %s)", GetSQLValueString($ParampackageID_WADApackages, "int"),GetSQLValueString($ParampackageID2_WADApackages, "int"),GetSQLValueString($ParamSessionpackageID_WADApackages, "int"));
$WADApackages = mysql_query($query_WADApackages, $connPackages) or die(mysql_error());
$row_WADApackages = mysql_fetch_assoc($WADApackages);
$totalRows_WADApackages = mysql_num_rows($WADApackages);
$colname_educationalDestinations = "1";
if (isset($_GET['PackageID'])) {
$colname_educationalDestinations = (get_magic_quotes_gpc()) ? packageID : addslashes(packageID);
mysql_select_db($database_connPackages, $connPackages);
$query_educationalDestinations = sprintf("SELECT * FROM destinations INNER JOIN (packages INNER JOIN packagedestinations ON packages.packageID = packagedestinations.packageID) ON destinations.destinationID = packagedestinations.destinationID WHERE packages.packageID = %s ORDER BY destination ASC", GetSQLValueString($colname_educationalDestinations, "int"));
$educationalDestinations = mysql_query($query_educationalDestinations, $connPackages) or die(mysql_error());
$row_educationalDestinations = mysql_fetch_assoc($educationalDestinations);
$totalRows_educationalDestinations = mysql_num_rows($educationalDestinations);
?>
And where I'm trying to display the destinations themselves, I have :
<table>
<tr>
<td>Destinations :</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_educationalDestinations['destination']; ?></td>
</tr>
<?php } while ($row_educationalDestinations = mysql_fetch_assoc($educationalDestinations)); ?>
</table>
If anyone could have a quick look and help me out that would be much appreciated - not sure if its my SQL at the top, or the PHP in the page, but either way it would be good to get it working.
Thanks.First off, you need to get the database tables so that there is a relationship between them.
In fact, if there is a one to one relationship, then it may be better to store all of your information in one table such as
table_packages
packageID
package
packageDetails
destination
destinationDetails
etc
If there is a one to many relationship, then the following would be true
packages
packageID
package
packageDetails
etc
destinations
destinationID
packageID
destination
destinationDetails
etc
The above assumes that there are many destinations to one package with the relationship coloured orange.
Once you have the above correct you can apply your query as follows
SELECT *
FROM packages
INNER JOIN destinations
ON packages.packageID = destinations.packageID
WHERE packages.packageID = %s
ORDER BY destination ASC
The above query will show all packages with relevant destinations -
Need help with LikeFilter for querying the keyset instead of value
Hi,
I'm looking for help with the LikeFilter.
I need to query the cache to get all entries with key starting with a particular string.
I could see samples using LikeFilter for querying the values in the cache but not the keyset.
Can someone help?
E.g:
Cache Entries:
abc123 - value1
abc234 - value2
bcd123 - value3
I want to get all entries with key starting with 'abc'.
thanks,
rama.NJ, thanks for the quick reply.
I tried something similar (as below) but this code gives me 'java.lang.NoClassDefFoundError: com/tangosol/util/ValueExtractor'.
KeyExtractor extractor = new KeyExtractor("getKey");
Filter filter = new LikeFilter(extractor, id+":%",'-',false);
-rama.
Edited by: 911950 on Feb 2, 2012 1:18 PM -
Need help with threads?.. please check my approach!!
Hello frnds,
I am trying to write a program.. who monitors my external tool.. please check my way of doing it.. as whenever i write programs having thread.. i end up goosy.. :(
first let me tell.. what I want from program.. I have to start an external tool.. on separate thread.. (as it takes some time).. then it takes some arguments(3 arguments).. from file.. so i read the file.. and have to run tool.. continously.. until there are arguments left.. in file.. or.. user has stopped it by pressing STOP button..
I have to put a marker in file too.. so that.. if program started again.. file is read from marker postion.. !!
Hope I make clear.. what am trying to do!!
My approach is like..
1. Have two buttons.. START and STOP on Frame..
START--> pressed
2. check marker("$" sign.. placed in beginning of file during start).. on file..
read File from marker.. got 3 arg.. pass it to tool.. and run it.. (on separate thread).. put marker.. (for next reading)
Step 2.. continously..
3. STOP--> pressed
until last thread.. stops.. keep running the tool.. and when last thread stops.. stop reading any more arguments..
Question is:
1. Should i read file again and again.. ?.. or read it once after "$" sign.. store data in array.. and once stopped pressed.. read file again.. and put marker ("$" sign) at last read line..
2. how should i know when my thread has stopped.. so I start tool again??.. am totally confused.. !!
please modify my approach.. if u find anything odd..
Thanks a lot in advance
gerviniHello,
I have no experience with threads or with having more than run "program" in a single java file. All my java files have the same structure. This master.java looks something like this:
---master.java---------------------------------------------------
import java.sql.*;
import...
public class Master {
public static void main(String args []) throws SQLException, IOException {
//create connection pool here
while (true) { // start loop here (each loop takes about five minutes)
// set values of variables
// select a slave process to run (from a list of slave programs)
execute selected slave program
// check for loop exit value
} // end while loop
System.out.println("Program Complete");
} catch (Exception e) {
System.out.println("Error: " + e);
} finally {
if (rSet1 != null)
try { rSet1.close(); } catch( SQLException ignore ) { /* ignored */ }
connection.close();
-------end master.java--------------------------------------------------------
This master.java program will run continuously for days or weeks, each time through the loop starting another slave process which runs for five minutes to up to an hour, which means there may be ten to twenty of these slave processes running simultaneously.
I believe threads is the best way to do this, but I don't know where to locate these slave programs: either inside the master.java program or separate slave.java files? I will need help with either method.
Your help is greatly appreciated. Thank you.
Logan -
Hi,
I've got a server audit log in PowerPivot (114,000 rows) which I provide some basic reporting from (PowerPivot is not my specialist subject so go easy). What I now need to perform a Distinct filter, but can't get the logic right. Basically the log
as two bits of information, 1) is the source of the job and 2) if it was a success or failure. What I need to do is to find all of the Source items that have never completed sucessfully. Any ideas on what formula is best to use, or
do I need to split in to multiple sheets and create a table relationship?
Source,Status
======,======
Source1,Fail
Source1,Fail
Source1,Success
Source2,Fail
Source3,Fail
Source3,Success
So in the above example, I would only expect the filter to show me Source2
Thanks
AlexHi Alex,
using Power Query instead, it would work like this:
Once you've pushed your table to PQ, add a column "helper" with value=1.
Then pivot on "Status", taking "helper"-column into "values column"
(hope translation is understandable, as I'm using localized Version & translation via "Quick info" isn't working in the PQ menu)
Then filter on column "Success" = blank.
Imke -
I have the following table
EX_ID
EX_NAME
EX_SURNAME
EX_FLAG
1
TOM
JONES
Y
1
JIM
SLIM
N
1
BO
SELECTA
Y
2
AIRES
BEARS
N
2
JIM
DAVIES
Y
3
PAUL
BALL
N
3
YOU
KNOW
N
I need to create a query that only displays one of the ex_id’s, it doesn’t matter which one. When the query has been run it will look like below:
EX_ID
EX_NAME
EX_SURNAME
EX_FLAG
1
TOM
JONES
Y
2
AIRES
BEARS
N
3
YOU
KNOW
N
Can anyone help with this query?SELECT * FROM
SELECT *,ROW_NUMBER () OVER (PARTITION BY ex_id ORDER BY (SELECT 0))
FROM tbl
) AS Der WHERE rn=1
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 -
I need help with a SELECT query - help!
Hello, I need help with a select statement.
I have a table with 2 fields as shown below
Name | Type
John | 1
John | 2
John | 3
Paul | 1
Paul | 2
Paul | 3
Mark | 1
Mark | 2
I need a query that returns everything where the name has type 1 or 2 but not type 3. So in the example above the qery should bring back all the "Mark" records.
Thanks,
IanOr, if the types are sequential from 1 upwards you could simply do:-
SQL> create table t as
2 select 'John' as name, 1 as type from dual union
3 select 'John',2 from dual union
4 select 'John',3 from dual union
5 select 'Paul',1 from dual union
6 select 'Paul',2 from dual union
7 select 'Paul',3 from dual union
8 select 'Paul',4 from dual union
9 select 'Mark',1 from dual union
10 select 'Mark',2 from dual;
Table created.
SQL> select name
2 from t
3 group by name
4 having count(*) <= 2;
NAME
Mark
SQL>Or another alternative if they aren't sequential:
SQL> ed
Wrote file afiedt.buf
1 select name from (
2 select name, max(type) t
3 from t
4 group by name
5 )
6* where t < 3
SQL> /
NAME
Mark
SQL>Message was edited by:
blushadow -
Help tune this monster query please
Hi, I have a query that runs for a long time. Its a system generated query but I need to improve its performance. I have enough indexes on the tables. Here is the query, its explain plan and the tkprof:
The QUERY
SELECT FD.FORM_ID, FD.FIELD_NAME, FD.FIELD_TEXT, FD.OPTION_TEXT, FD.OPTION_TYPE, FD.FIELD_ORDER, FD.LIST_ORDER,
FD.MULTIPLE_ANSWER, FD.FIELD_INSTANCE, NVL(AD.APPS,0) APPS
FROM (
SELECT FIELD_NAME, FIELD_VALUE, INSTANCE, COUNT(0) APPS
FROM APPLICATION_DATA AD
WHERE APPLICATION_ID IN (
SELECT A.APPLICATION_ID
FROM APPLICATIONS A
WHERE A.DELETED = 0 AND DECODE(A.TRAY,'Incomplete','Incomplete','Complete') = 'Complete' AND A.JOB_ID IN (
SELECT JOB_ID
FROM JOBS J
WHERE J.ACCOUNT_ID IN (
SELECT ACCOUNT_ID
FROM AGENCY_ACCOUNTS CONNECT BY ACCOUNT_ID = PRIOR AGENCY_ID START WITH ACCOUNT_ID = J.ACCOUNT_ID ) ) AND A.ACCOUNT_ID IN (
SELECT ACCOUNT_ID
FROM AGENCY_ACCOUNTS CONNECT BY ACCOUNT_ID = PRIOR AGENCY_ID START WITH ACCOUNT_ID = 113346 ) AND FIELD_NAME IN (
SELECT FIELD_NAME FROM APPLICATION_FIELDS
WHERE FIELD_TYPE IN ('Checkbox','Radio','Select','SelectM', 'RadioHoriz','RadioPara') ) )
GROUP BY FIELD_NAME, FIELD_VALUE, INSTANCE ) AD, (
SELECT AF.FORM_ID, AF.FIELD_NAME, AF.FIELD_TEXT, AFO.OPTION_TEXT, AFO.OPTION_TYPE, AF.FIELD_ORDER, AFO.LIST_ORDER,
DECODE(AF.FIELD_TYPE,'Checkbox',1,'SelectM',1,0) MULTIPLE_ANSWER, AF.FIELD_INSTANCE
FROM APPLICATION_FIELDS AF, APPLICATION_FIELD_OPTIONS AFO, JOB_FORMS JF
WHERE AFO.FIELD_NAME = AF.FIELD_NAME AND AFO.FORM_ID = AF.FORM_ID AND JF.FORM_ID = AF.FORM_ID AND AF.FIELD_TYPE IN
('Checkbox','Radio','Select','SelectM', 'RadioHoriz','RadioPara') AND JF.JOB_ID IN (
SELECT JOB_ID
FROM JOBS J
WHERE J.ACCOUNT_ID IN (
SELECT ACCOUNT_ID
FROM AGENCY_ACCOUNTS CONNECT BY ACCOUNT_ID = PRIOR AGENCY_ID START WITH ACCOUNT_ID = 113346 ) ) ) FD
WHERE AD.FIELD_NAME = FD.FIELD_NAME AND AD.FIELD_VALUE = FD.OPTION_TEXT AND AD.INSTANCE = FD.FIELD_INSTANCE
GROUP BY FD.FORM_ID, FD.FIELD_NAME, FD.FIELD_TEXT, FD.OPTION_TEXT, FD.OPTION_TYPE, FD.FIELD_ORDER, FD.LIST_ORDER,
FD.MULTIPLE_ANSWER, FD.FIELD_INSTANCE, NVL(AD.APPS,0)
ORDER BY FD.FORM_ID ASC, FD.FIELD_ORDER ASCEXPLAIN PLAN OUTPUT
PLAN_TABLE_OUTPUT
Plan hash value: 3519364953
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 120 | 763 (2)| 00:00:10 |
| 1 | SORT GROUP BY | | 1 | 120 | 763 (2)| 00:00:10 |
| 2 | VIEW | | 1 | 120 | 762 (1)| 00:00:10 |
| 3 | HASH GROUP BY | | 1 | 220 | 762 (1)| 00:00:10 |
|* 4 | FILTER | | | | | |
|* 5 | TABLE ACCESS BY INDEX ROWID | APPLICATION_DATA | 1 | 45 | 6 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
| 6 | NESTED LOOPS | | 40 | 8800 | 486 (2)| 00:00:06 |
|* 7 | HASH JOIN | | 60 | 10500 | 125 (4)| 00:00:02 |
|* 8 | HASH JOIN | | 60 | 7320 | 53 (6)| 00:00:01 |
| 9 | NESTED LOOPS | | 11 | 297 | 9 (12)| 00:00:01 |
| 10 | VIEW | VW_NSO_3 | 3 | 15 | 5 (0)| 00:00:01 |
| 11 | HASH UNIQUE | | 3 | 69 | | |
| 12 | TABLE ACCESS BY INDEX ROWID | JOBS | 3 | 30 | 3 (0)| 00:00:01 |
| 13 | NESTED LOOPS | | 3 | 69 | 5 (0)| 00:00:01 |
| 14 | VIEW | VW_NSO_1 | 1 | 13 | 2 (0)| 00:00:01 |
|* 15 | CONNECT BY WITH FILTERING | | | | | |
| 16 | TABLE ACCESS BY INDEX ROWID | AGENCY_ACCOUNTS | | | | |
PLAN_TABLE_OUTPUT
|* 17 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | 5 | 1 (0)| 00:00:01 |
| 18 | NESTED LOOPS | | | | | |
| 19 | BUFFER SORT | | | | | |
| 20 | CONNECT BY PUMP | | | | | |
| 21 | TABLE ACCESS BY INDEX ROWID| AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
|* 22 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | | 1 (0)| 00:00:01 |
|* 23 | TABLE ACCESS FULL | AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
|* 24 | INDEX RANGE SCAN | JOBS_ACCOUNT_ID | 3 | | 1 (0)| 00:00:01 |
|* 25 | INDEX RANGE SCAN | JOBS_FORMS_JID_FID | 4 | 88 | 1 (0)| 00:00:01 |
|* 26 | TABLE ACCESS FULL | APPLICATION_FIELDS | 3579 | 332K| 43 (3)| 00:00:01 |
| 27 | TABLE ACCESS FULL | APPLICATION_FIELD_OPTIONS | 32897 | 1702K| 72 (3)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 28 | INDEX RANGE SCAN | IDX$$_B8D40001 | 4 | | 3 (0)| 00:00:01 |
|* 29 | FILTER | | | | | |
| 30 | MERGE JOIN CARTESIAN | | 3 | 225 | 11 (0)| 00:00:01 |
| 31 | NESTED LOOPS | | 1 | 53 | 6 (0)| 00:00:01 |
| 32 | NESTED LOOPS | | 1 | 40 | 4 (0)| 00:00:01 |
|* 33 | TABLE ACCESS BY INDEX ROWID | APPLICATIONS | 1 | 30 | 3 (0)| 00:00:01 |
|* 34 | INDEX UNIQUE SCAN | APPS_APP_ID | 1 | | 2 (0)| 00:00:01 |
| 35 | TABLE ACCESS BY INDEX ROWID | JOBS | 18780 | 183K| 1 (0)| 00:00:01 |
|* 36 | INDEX UNIQUE SCAN | JOBS_JOB_ID | 1 | | 0 (0)| 00:00:01 |
|* 37 | VIEW | VW_NSO_2 | 1 | 13 | 2 (0)| 00:00:01 |
|* 38 | CONNECT BY WITH FILTERING | | | | | |
PLAN_TABLE_OUTPUT
| 39 | TABLE ACCESS BY INDEX ROWID | AGENCY_ACCOUNTS | | | | |
|* 40 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | 5 | 1 (0)| 00:00:01 |
| 41 | NESTED LOOPS | | | | | |
| 42 | BUFFER SORT | | | | | |
| 43 | CONNECT BY PUMP | | | | | |
| 44 | TABLE ACCESS BY INDEX ROWID | AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
|* 45 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | | 1 (0)| 00:00:01 |
|* 46 | TABLE ACCESS FULL | AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
| 47 | BUFFER SORT | | 3 | 66 | 9 (0)| 00:00:01 |
| 48 | INLIST ITERATOR | | | | | |
|* 49 | INDEX RANGE SCAN | IDX$$_91CA0001 | 3 | 66 | 5 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 50 | FILTER | | | | | |
|* 51 | CONNECT BY WITH FILTERING | | | | | |
| 52 | TABLE ACCESS BY INDEX ROWID | AGENCY_ACCOUNTS | | | | |
|* 53 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | 5 | 1 (0)| 00:00:01 |
| 54 | NESTED LOOPS | | | | | |
| 55 | BUFFER SORT | | | | | |
| 56 | CONNECT BY PUMP | | | | | |
| 57 | TABLE ACCESS BY INDEX ROWID | AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
|* 58 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | | 1 (0)| 00:00:01 |
|* 59 | TABLE ACCESS FULL | AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
4 - filter( EXISTS (SELECT 0 FROM "APPLICATIONS" "A","JOBS" "SYS_ALIAS_1", (SELECT "ACCOUNT_ID" "$nso_col_1"
FROM "AGENCY_ACCOUNTS" "AGENCY_ACCOUNTS" WHERE "ACCOUNT_ID"=NULL) "VW_NSO_2","APPLICATION_FIELDS"
"APPLICATION_FIELDS" WHERE EXISTS (SELECT 0 FROM "AGENCY_ACCOUNTS" "AGENCY_ACCOUNTS" WHERE "ACCOUNT_ID"=NULL AND
("ACCOUNT_ID"=:B1)) AND ("FIELD_TYPE"='Checkbox' OR "FIELD_TYPE"='Radio' OR "FIELD_TYPE"='RadioHoriz' OR
"FIELD_TYPE"='RadioPara' OR "FIELD_TYPE"='Select' OR "FIELD_TYPE"='SelectM') AND "FIELD_NAME"=:B2 AND
"A"."ACCOUNT_ID"="$nso_col_1" AND "A"."JOB_ID"="JOB_ID" AND "A"."APPLICATION_ID"=:B3 AND
DECODE("A"."TRAY",'Incomplete','Incomplete','Complete')='Complete' AND "A"."DELETED"=0))
PLAN_TABLE_OUTPUT
5 - filter("FIELD_NAME"="AF"."FIELD_NAME" AND "INSTANCE"="AF"."FIELD_INSTANCE")
7 - access("AFO"."FIELD_NAME"="AF"."FIELD_NAME" AND "AFO"."FORM_ID"="AF"."FORM_ID")
8 - access("JF"."FORM_ID"="AF"."FORM_ID")
15 - filter("ACCOUNT_ID"=113346)
17 - access("ACCOUNT_ID"=113346)
22 - access("ACCOUNT_ID"=NULL)
23 - access("ACCOUNT_ID"=NULL)
24 - access("J"."ACCOUNT_ID"="$nso_col_1")
25 - access("JF"."JOB_ID"="$nso_col_1")
26 - filter("AF"."FIELD_TYPE"='Checkbox' OR "AF"."FIELD_TYPE"='Radio' OR "AF"."FIELD_TYPE"='RadioHoriz' OR
"AF"."FIELD_TYPE"='RadioPara' OR "AF"."FIELD_TYPE"='Select' OR "AF"."FIELD_TYPE"='SelectM')
PLAN_TABLE_OUTPUT FOR THE QUERY
28 - access("FIELD_VALUE"="AFO"."OPTION_TEXT")
29 - filter( EXISTS (SELECT 0 FROM "AGENCY_ACCOUNTS" "AGENCY_ACCOUNTS" WHERE "ACCOUNT_ID"=NULL AND
("ACCOUNT_ID"=:B1)))
33 - filter(DECODE("A"."TRAY",'Incomplete','Incomplete','Complete')='Complete' AND "A"."DELETED"=0)
34 - access("A"."APPLICATION_ID"=:B1)
36 - access("A"."JOB_ID"="JOB_ID")
37 - filter("A"."ACCOUNT_ID"="$nso_col_1")
38 - filter("ACCOUNT_ID"=113346)
40 - access("ACCOUNT_ID"=113346)
45 - access("ACCOUNT_ID"=NULL)
46 - access("ACCOUNT_ID"=NULL)
PLAN_TABLE_OUTPUT
49 - access("FIELD_NAME"=:B1 AND ("FIELD_TYPE"='Checkbox' OR "FIELD_TYPE"='Radio' OR "FIELD_TYPE"='RadioHoriz'
OR "FIELD_TYPE"='RadioPara' OR "FIELD_TYPE"='Select' OR "FIELD_TYPE"='SelectM'))
50 - filter("ACCOUNT_ID"=:B1)
51 - filter("ACCOUNT_ID"=:B1)
53 - access("ACCOUNT_ID"=:B1)
58 - access("ACCOUNT_ID"=NULL)
59 - access("ACCOUNT_ID"=NULL)
106 rows selected.TKPROF FOR THE QUERY
call count cpu elapsed disk query current rows
Parse 1 0.05 0.08 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 17 1040.45 1018.36 0 48926569 0 229
total 19 1040.50 1018.44 0 48926569 0 229
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 68
Rows Row Source Operation
229 SORT GROUP BY (cr=48926569 pr=0 pw=0 time=1018362160 us)
454 VIEW (cr=48926569 pr=0 pw=0 time=1018361382 us)
454 HASH GROUP BY (cr=48926569 pr=0 pw=0 time=1018360468 us)
185302 FILTER (cr=48926569 pr=0 pw=0 time=877249113 us)
1440799 TABLE ACCESS BY INDEX ROWID APPLICATION_DATA (cr=11309333 pr=0 pw=0 time=213262026 us)
82907114 NESTED LOOPS (cr=174051 pr=0 pw=0 time=166906535 us)
1790 HASH JOIN (cr=625 pr=0 pw=0 time=41617 us)
121 HASH JOIN (cr=310 pr=0 pw=0 time=11263 us)
39 NESTED LOOPS (cr=121 pr=0 pw=0 time=6894 us)
44 VIEW VW_NSO_3 (cr=75 pr=0 pw=0 time=6424 us)
44 HASH UNIQUE (cr=75 pr=0 pw=0 time=6333 us)
44 TABLE ACCESS BY INDEX ROWID JOBS (cr=75 pr=0 pw=0 time=3090 us)
52 NESTED LOOPS (cr=32 pr=0 pw=0 time=58177 us)
7 VIEW VW_NSO_1 (cr=23 pr=0 pw=0 time=1242 us)
7 CONNECT BY WITH FILTERING (cr=23 pr=0 pw=0 time=1212 us)
1 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=3 pr=0 pw=0 time=185 us)
1 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=2 pr=0 pw=0 time=100 us)(object id 60086)
6 NESTED LOOPS (cr=20 pr=0 pw=0 time=590 us)
7 BUFFER SORT (cr=0 pr=0 pw=0 time=248 us)
7 CONNECT BY PUMP (cr=0 pr=0 pw=0 time=95 us)
6 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=20 pr=0 pw=0 time=314 us)
6 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=14 pr=0 pw=0 time=188 us)(object id 60086)
0 TABLE ACCESS FULL AGENCY_ACCOUNTS (cr=0 pr=0 pw=0 time=0 us)
44 INDEX RANGE SCAN JOBS_ACCOUNT_ID (cr=9 pr=0 pw=0 time=280 us)(object id 60253)
39 INDEX RANGE SCAN JOBS_FORMS_JID_FID (cr=46 pr=0 pw=0 time=968 us)(object id 60299)
3579 TABLE ACCESS FULL APPLICATION_FIELDS (cr=189 pr=0 pw=0 time=14469 us)
32524 TABLE ACCESS FULL APPLICATION_FIELD_OPTIONS (cr=315 pr=0 pw=0 time=32629 us)
82905323 INDEX RANGE SCAN IDX$$_B8D40001 (cr=173426 pr=0 pw=0 time=83870105 us)(object id 60121)
185297 FILTER (cr=37617236 pr=0 pw=0 time=749052070 us)
185297 MERGE JOIN CARTESIAN (cr=37617196 pr=0 pw=0 time=742583363 us)
185297 NESTED LOOPS (cr=35393366 pr=0 pw=0 time=706772617 us)
1139675 NESTED LOOPS (cr=9180841 pr=0 pw=0 time=84949686 us)
1140164 TABLE ACCESS BY INDEX ROWID APPLICATIONS (cr=5760834 pr=0 pw=0 time=46774108 us)
1440060 INDEX UNIQUE SCAN APPS_APP_ID (cr=4320774 pr=0 pw=0 time=24380604 us)(object id 60107)
1139675 TABLE ACCESS BY INDEX ROWID JOBS (cr=3420007 pr=0 pw=0 time=28126171 us)
1139675 INDEX UNIQUE SCAN JOBS_JOB_ID (cr=2280328 pr=0 pw=0 time=14563524 us)(object id 60252)
185297 VIEW VW_NSO_2 (cr=26212525 pr=0 pw=0 time=613602445 us)
6866175 CONNECT BY WITH FILTERING (cr=26212525 pr=0 pw=0 time=614183170 us)
1139675 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=3419025 pr=0 pw=0 time=24323520 us)
1139675 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=2279350 pr=0 pw=0 time=13905212 us)(object id 60086)
6838050 NESTED LOOPS (cr=22793500 pr=0 pw=0 time=388173853 us)
7977725 BUFFER SORT (cr=0 pr=0 pw=0 time=178812411 us)
7977725 CONNECT BY PUMP (cr=0 pr=0 pw=0 time=57522094 us)
6838050 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=22793500 pr=0 pw=0 time=179425469 us)
6838050 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=15955450 pr=0 pw=0 time=113988543 us)(object id 60086)
0 TABLE ACCESS FULL AGENCY_ACCOUNTS (cr=0 pr=0 pw=0 time=0 us)
185297 BUFFER SORT (cr=2223830 pr=0 pw=0 time=24721936 us)
1208625 INLIST ITERATOR (cr=2223830 pr=0 pw=0 time=26470412 us)
1208625 INDEX RANGE SCAN IDX$$_91CA0001 (cr=2223830 pr=0 pw=0 time=18174073 us)(object id 60129)
2 FILTER (cr=40 pr=0 pw=0 time=1292 us)
2 CONNECT BY WITH FILTERING (cr=40 pr=0 pw=0 time=1276 us)
2 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=6 pr=0 pw=0 time=86 us)
2 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=4 pr=0 pw=0 time=46 us)(object id 60086)
10 NESTED LOOPS (cr=34 pr=0 pw=0 time=791 us)
12 BUFFER SORT (cr=0 pr=0 pw=0 time=369 us)
12 CONNECT BY PUMP (cr=0 pr=0 pw=0 time=127 us)
10 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=34 pr=0 pw=0 time=376 us)
10 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=24 pr=0 pw=0 time=242 us)(object id 60086)
0 TABLE ACCESS FULL AGENCY_ACCOUNTS (cr=0 pr=0 pw=0 time=0 us)Any help in tuning this query to run faster will be highly appreciated. I also noticed merge join certesian on the tkprof and explain plan. Any idea in takling that will also be appreciated.
Cheers,
AdeIt's quite hard to tune a query without seeing the table structure and available indices as well as relationship between each other but I'll try.
In your sql which you've given the table alias AD, you have this filter criteria
AND FIELD_NAME IN (
SELECT FIELD_NAME
FROM APPLICATION_FIELDS
WHERE FIELD_TYPE IN ('Checkbox','Radio','Select','SelectM', 'RadioHoriz','RadioPara')
) </br>
My question is, is FIELD_NAME a column in the APPLICATION_DATA table? If it is, try moving this clause outside of the current sub-query it is in, i.e. one more level up. It looks like you put them inside the wrong level.
I would also try converting this <COL> IN <SUB-QUERY> to a join, if that wouldn't affect the no. of rows returned. I can't tell for sure since I dont know the relationship between your tables.
It looks to me like you're doing this
SELECT <col list>
FROM ( SELECT -- LEVEL 1
FROM APPLICATION_DATA AD
WHERE AD.APPLICAITON_ID IN ( -- LEVEL 2
SELECT
FROM APPLICATIONS A
WHERE A.JOB_ID IN (
<SUBQUERY>
AND A.ACCOUNT_ID IN (
<SUBQUERY>
AND FIELDNAME IN ( -- SHOULD BE INSIDE LEVEL1
<SUBQUERY>
) AD,
( SELECT ....
) FD
WHERE ....
Maybe you are looking for
-
I can close the little blue 'drag' box every time I open Firefox, but that is a hassle, and I know it should not be necessary. When I try to eject the 'peripheral' icon, it says I cannot because Firefox is in use. I have to wait until I close Firefox
-
Device error -the target device isn't suitable for use. Solution found!?
Hello everyone, I have received the following error many times on my machine for different projects when trying to burn to disk and folders: Device error -the target device isn't suitable for use. I have multiple hard drives with ~60GB, 40GB and 12GB
-
Pro*C/C++ generates error "PCC-S-02015, unable to open include file"
I'm running a .pc file through the pre-compiler (on Windows 7x64 with instant client 12.1) and get the following error: Error at line 78, column 1 in file XXX.pc EXEC SQL INCLUDE SQLCA; 1 PCC-S-02015, unable to open include file If I change the conte
-
Hi Gurus, Can some one explainhow many process chain types are there in sap bw3.5.I searched in forums.But i didnt get answer. Regards Arun
-
How to turn of "Automatic Start/Stop Detection for HDV Caputre
Hello, I'm pulling my hair out trying to capture HDV 1080i-50 without getting separate clips created by the metadata at the start and stop of each shot. It's that feature called "Automatic Start/Stop Detection." I'm not talking about "Make new clip o