Spatial query w/ logical operators in a subquery on Linux using Oracle 10g
Hello...
I'm being given XML that I need to parse and create SQL from it. Below my signature is the SQL that I generate (its a simple example) and can be more elaborate due to the logical operators (AND and OR) given in the XML.
The problem that we're seeing is performance-based: when one of the logical operator queries is Spatial-based, like below. Running it in JDBC, the query never returns.
The spatial query just by itself returns ~300 rows (takes approximately 0.2 seconds). The "PERCENTAGE" query by itself returns about ~40000 rows (takes approximately ~.8 seconds).
If we run the query below with 2 non-spatial subqueries, the result returns and performance is very acceptable (~ 0.9 seconds)-- the result set is about 80000 rows.
Thanks,
Jim
=========================
SELECT
COLUMN_WE_WANT , RESULTS
FROM
TABLE_A
WHERE
COLUMN_WE_WANT IN
SELECT
COLUMN_WE_WANT
FROM
TABLE_A
WHERE
SDO_OVERLAPBDYINTERSECT(TABLE_A.MY_SPATIAL_COLUMN,
SDO_GEOMETRY(2003,
4326,
null,
SDO_elem_info_array( 1 , 3 , 1 ),
SDO_ORDINATE_ARRAY( lng_1,lat_1 , lng_2,lat_2 , lng_3,lat_3 , lng_4,lat_4 , lng_1,lat_1 ) )
) = 'TRUE'
OR
COLUMN_WE_WANT IN
SELECT
COLUMN_WE_WANT
FROM
TABLE_B
WHERE
SOME_PERCENTAGE_RATE_COLUMN < 90
)
There is a spatial forum. You will likely have a far better experience there.
Similar Messages
-
Spatial query w/ logical operators in a subquery on Linux using Oracle 1
Hello...
I'm being given XML that I need to parse and create SQL from it. Below my signature is the SQL that I generate (its a simple example) and can be more elaborate due to the logical operators (AND and OR) given in the XML.
The problem that we're seeing is performance-based: when one of the logical operator queries is Spatial-based, like below. Running it in JDBC, the query never returns.
The spatial query just by itself returns ~300 rows (takes approximately 0.2 seconds). The "PERCENTAGE" query by itself returns about ~40000 rows (takes approximately ~.8 seconds).
If we run the query below with 2 non-spatial subqueries, the result returns and performance is very acceptable (~ 0.9 seconds)-- the result set is about 80000 rows.
Thanks,
Jim
=========================
SELECT
COLUMN_WE_WANT , RESULTS
FROM
TABLE_A
WHERE
COLUMN_WE_WANT IN
SELECT
COLUMN_WE_WANT
FROM
TABLE_A
WHERE
SDO_OVERLAPBDYINTERSECT(TABLE_A.MY_SPATIAL_COLUMN,
SDO_GEOMETRY(2003,
4326,
null,
SDO_elem_info_array( 1 , 3 , 1 ),
SDO_ORDINATE_ARRAY( lng_1,lat_1 , lng_2,lat_2 , lng_3,lat_3 , lng_4,lat_4 , lng_1,lat_1 )
) = 'TRUE'
OR
COLUMN_WE_WANT IN
SELECT
COLUMN_WE_WANT
FROM
TABLE_B
WHERE
SOME_PERCENTAGE_RATE_COLUMN < 90
)Its difficult to comment without seeing the execution plan. You should trace this query to get a better idea of exactly what's happening.
Depending on the complexity of the logical operators, I would look at doing this using set operations. So for an OR you might have...
SELECT COLUMN_WE_WANT, RESULTS
FROM TABLE_A
WHERE COLUMN_WE_WANT IN (
SELECT COLUMN_WE_WANT
FROM TABLE_A
WHERE SDO_OVERLAPBDYINTERSECT(TABLE_A.MY_SPATIAL_COLUMN,SDO_GEOMETRY(2003,4326,
NULL, SDO_elem_info_array( 1 , 3 , 1 ),
SDO_ORDINATE_ARRAY( lng_1,lat_1 , lng_2,lat_2 , lng_3,lat_3 , lng_4,lat_4 , lng_1,lat_1 ) )) = 'TRUE'
UNION
SELECT COLUMN_WE_WANT
FROM TABLE_B
WHERE SOME_PERCENTAGE_RATE_COLUMN < 90)For an AND, you would use INTERSECT.
Edited by: Reggie to remove the extra INTERSECT -
Query working fine in 9i but throwing an error in Oracle 10g
Hi All,
I am having a query which contains large number of When clauses inside a case statement.
The Same SQL is working fine in 9i, but not working in 10G.
If we try to remove one of the When clause in the query, its working fine else it is giving the error ORA-00939 Too many arguments for functions.
Can any one tell me the solution for this and what is the maximum number of when clauses allowed inside case statemen in oracle 10g.
Thanks in advance
Regards
Karthikit should not have worked in 9iR2... it is correct according to the doc to return an error message when using more than 255 expressions...
SQL> select version from v$instance;
VERSION
9.2.0.7.0
SQL> select case 1
2 when 2 then 3
3 when 4 then 5
4 when 6 then 7
5 when 8 then 9
6 when 10 then 11
7 when 12 then 13
8 when 14 then 15
9 when 16 then 17
10 when 18 then 19
11 when 20 then 21
12 when 22 then 23
13 when 24 then 25
14 when 26 then 27
15 when 28 then 29
16 when 30 then 31
17 when 32 then 33
18 when 34 then 35
19 when 36 then 37
20 when 38 then 39
21 when 40 then 41
22 when 42 then 43
23 when 44 then 45
24 when 46 then 47
25 when 48 then 49
26 when 50 then 51
27 when 52 then 53
28 when 54 then 55
29 when 56 then 57
30 when 58 then 59
31 when 60 then 61
32 when 62 then 63
33 when 64 then 65
34 when 66 then 67
35 when 68 then 69
36 when 70 then 71
37 when 72 then 73
38 when 74 then 75
39 when 76 then 77
40 when 78 then 79
41 when 80 then 81
42 when 82 then 83
43 when 84 then 85
44 when 86 then 87
45 when 88 then 89
46 when 90 then 91
47 when 92 then 93
48 when 94 then 95
49 when 96 then 97
50 when 98 then 99
51 when 100 then 101
52 when 102 then 103
53 when 104 then 105
54 when 106 then 107
55 when 108 then 109
56 when 110 then 111
57 when 112 then 113
58 when 114 then 115
59 when 116 then 117
60 when 118 then 119
61 when 120 then 121
62 when 122 then 123
63 when 124 then 125
64 when 126 then 127
65 when 128 then 129
66 when 130 then 131
67 when 132 then 133
68 when 134 then 135
69 when 136 then 137
70 when 138 then 139
71 when 140 then 141
72 when 142 then 143
73 when 144 then 145
74 when 146 then 147
75 when 148 then 149
76 when 150 then 151
77 when 152 then 153
78 when 154 then 155
79 when 156 then 157
80 when 158 then 159
81 when 160 then 161
82 when 162 then 163
83 when 164 then 165
84 when 166 then 167
85 when 168 then 169
86 when 170 then 171
87 when 172 then 173
88 when 174 then 175
89 when 176 then 177
90 when 178 then 179
91 when 180 then 181
92 when 182 then 183
93 when 184 then 185
94 when 186 then 187
95 when 188 then 189
96 when 190 then 191
97 when 192 then 193
98 when 194 then 195
99 when 196 then 197
100 when 198 then 199
101 when 200 then 201
102 when 202 then 203
103 when 204 then 205
104 when 206 then 207
105 when 208 then 209
106 when 210 then 211
107 when 212 then 213
108 when 214 then 215
109 when 216 then 217
110 when 218 then 219
111 when 220 then 221
112 when 222 then 223
113 when 224 then 225
114 when 226 then 227
115 when 228 then 229
116 when 230 then 231
117 when 232 then 233
118 when 234 then 235
119 when 236 then 237
120 when 238 then 239
121 when 240 then 241
122 when 242 then 243
123 when 244 then 245
124 when 246 then 247
125 when 248 then 249
126 when 250 then 251
127 when 252 then 253
128 when 254 then 255
129 when 256 then 257
130 end x from dual;
X
SQL> select version from v$instance;
VERSION
10.2.0.2.0
SQL> select case 1
2 when 2 then 3
3 when 4 then 5
4 when 6 then 7
5 when 8 then 9
6 when 10 then 11
7 when 12 then 13
8 when 14 then 15
9 when 16 then 17
10 when 18 then 19
11 when 20 then 21
12 when 22 then 23
13 when 24 then 25
14 when 26 then 27
15 when 28 then 29
16 when 30 then 31
17 when 32 then 33
18 when 34 then 35
19 when 36 then 37
20 when 38 then 39
21 when 40 then 41
22 when 42 then 43
23 when 44 then 45
24 when 46 then 47
25 when 48 then 49
26 when 50 then 51
27 when 52 then 53
28 when 54 then 55
29 when 56 then 57
30 when 58 then 59
31 when 60 then 61
32 when 62 then 63
33 when 64 then 65
34 when 66 then 67
35 when 68 then 69
36 when 70 then 71
37 when 72 then 73
38 when 74 then 75
39 when 76 then 77
40 when 78 then 79
41 when 80 then 81
42 when 82 then 83
43 when 84 then 85
44 when 86 then 87
45 when 88 then 89
46 when 90 then 91
47 when 92 then 93
48 when 94 then 95
49 when 96 then 97
50 when 98 then 99
51 when 100 then 101
52 when 102 then 103
53 when 104 then 105
54 when 106 then 107
55 when 108 then 109
56 when 110 then 111
57 when 112 then 113
58 when 114 then 115
59 when 116 then 117
60 when 118 then 119
61 when 120 then 121
62 when 122 then 123
63 when 124 then 125
64 when 126 then 127
65 when 128 then 129
66 when 130 then 131
67 when 132 then 133
68 when 134 then 135
69 when 136 then 137
70 when 138 then 139
71 when 140 then 141
72 when 142 then 143
73 when 144 then 145
74 when 146 then 147
75 when 148 then 149
76 when 150 then 151
77 when 152 then 153
78 when 154 then 155
79 when 156 then 157
80 when 158 then 159
81 when 160 then 161
82 when 162 then 163
83 when 164 then 165
84 when 166 then 167
85 when 168 then 169
86 when 170 then 171
87 when 172 then 173
88 when 174 then 175
89 when 176 then 177
90 when 178 then 179
91 when 180 then 181
92 when 182 then 183
93 when 184 then 185
94 when 186 then 187
95 when 188 then 189
96 when 190 then 191
97 when 192 then 193
98 when 194 then 195
99 when 196 then 197
100 when 198 then 199
101 when 200 then 201
102 when 202 then 203
103 when 204 then 205
104 when 206 then 207
105 when 208 then 209
106 when 210 then 211
107 when 212 then 213
108 when 214 then 215
109 when 216 then 217
110 when 218 then 219
111 when 220 then 221
112 when 222 then 223
113 when 224 then 225
114 when 226 then 227
115 when 228 then 229
116 when 230 then 231
117 when 232 then 233
118 when 234 then 235
119 when 236 then 237
120 when 238 then 239
121 when 240 then 241
122 when 242 then 243
123 when 244 then 245
124 when 246 then 247
125 when 248 then 249
126 when 250 then 251
127 when 252 then 253
128 when 254 then 255
129 when 256 then 257
130 end x from dual;
when 16 then 17
ERROR at line 9:
ORA-00939: too many arguments for function
SQL> del 129
SQL> /
X
---------- -
Hi,
Whats the best way to perform a Spatial Query on a
Topology table ?
The query below fails with a:
ORA-13226: interface not supported without a spatial index error.
SELECT SDO_TOPO_GEOMETRY.GET_GEOMETRY(FEATURE)
FROM SCOTT.COUNTIES_TOPO
WHERE SDO_FILTER(
SDO_TOPO_GEOMETRY.GET_GEOMETRY(FEATURE),
SDO_CS.VIEWPORT_TRANSFORM(
MDSYS.SDO_GEOMETRY( 2003, 8307, NULL, MDSYS.SDO_ELEM_INFO_ARRAY( 1,1003,3 ),
MDSYS.SDO_ORDINATE_ARRAY( -73.728203, 44.985874, -69.728203, 48.985874 ) ) , 8307
) , 'mask=anyinteract querytype=window') = 'TRUE'
Would it be better to use the Java TopoMap API, to load
the Window I am interested in and get the ID's of the
Nodes, Edge's and Face's in that area, then put them into
a SDO_TOPO_GEOMETRY.GET_GEOMETRY query ?
Cheers,
RoHi Ro,
Check out the end of lesson 17!
A few notes:
You don't need viewport_transform in Oracle 10g Spatial.
You don't need mdsys for the constructors in Oracle 10g Spatial.
Use SDO_FILTER or SDO_ANYINTERACT with feature layers a topology (not SDO_FILTER with mask=anyinteract).
Here are rewritten versions of your query (one with sdo_filter, one with sdo_anyinteract)
SELECT SDO_TOPO_GEOMETRY.GET_GEOMETRY(FEATURE)
FROM COUNTIES_TOPO
WHERE SDO_ANYINTERACT(FEATURE,
SDO_GEOMETRY( 2003, 8307, NULL,
SDO_ELEM_INFO_ARRAY( 1,1003,3 ),
SDO_ORDINATE_ARRAY( -73.728203, 44.985874, -69.728203, 48.985874 ))) = 'TRUE';
or if you only want sdo_filter:
SELECT SDO_TOPO_GEOMETRY.GET_GEOMETRY(FEATURE)
FROM COUNTIES_TOPO
WHERE SDO_FILTER(FEATURE,
SDO_GEOMETRY( 2003, 8307, NULL,
SDO_ELEM_INFO_ARRAY( 1,1003,3 ),
SDO_ORDINATE_ARRAY( -73.728203, 44.985874, -69.728203, 48.985874 ))) = 'TRUE';
It was great meeting you the week before last - it's always nice to meet the people who post to this forum. I've been told I seem taller here than in person!
Dan -
0
down vote
favorite I am using oracle 10g. I have a temp table TEMP.
TEMP has following structure:-
USER COUNT TYPE
1 10 T1
2 21 T2
3 45 T1
1 7 T1
I need a query which will show all types has column names,and types can be any value like T1,T2,..Tn and columns will be like:-
USER T1 T2 Tn
and User column will show all the users and T1,T2 column will show total count of types.
Edited by: 969468 on Nov 15, 2012 9:35 PMPlease see my original post ("I have a page erroring in production (but not in development) when it gets to a date that it needs to display.") Sorry if it came across as vague. It made sense, to me, when I typed it. But, then, I'm usually typing fast just to get the question out there, when I'm in a hurry.
Haven't done a CFDUMP, yet, as every time I make a change in development that needs to be tested in production, I have to notify my supervisor that there are files that need to be copied into production, which can sometimes take a while, so I try to do troubleshooting on dev side - it's a pain in the you-know-what, but that's the kind of environment I'm working in.
As it turns out, changing the format in the SELECT to_char() did the trick. If anyone else has this issue with Oracle 10g, I'm now using SELECT to_char(create_date,'YYYY/MM/DD HH:MI') FROM tableA, and now the CFOUTPUT is processing the whole page. I guess the MM-DD-YYYY threw CF into a tizzy, breaking the process?
Anyhoo, it's working, now. Thank you, Dan and Adam, for your thoughts on this.
^_^ -
Hi,
I want to create a view. Sales amounts, countries and products will be showed in this view.
Report result will be like below:
Products
Countries Sales_Amount
TV Ipad Iphone Netbook Notebook EbookReader
England 1000 1200 1400 3000 5000 200
Germany 800 1000 1300 2800 6000 400
France 1100 1100 1500 2400 3000 500
Number of products are not limited. New prodcuts can be added by the time.
Customer is using Oracle 10g. So I can not use pivot function which cames with Oracle 11g.
If the number of products is limited, I can write sql by decode operators.
But I can not find how to implement pivot function in Oracle 10g with unlimited column values.
Do you have any comment?
Thanks,RegardsFrom the SQL and PL/SQL FAQ:
"This is not easily possible as the number of columns returned by an SQL must be known before any data is fetched, it would have to be done dynamically.
See these threads:
Franks pivoting, static and dynamic
Dynamic Columns Pipelined"
SQL and PL/SQL FAQ -
Hibernet query returns null for XMLTYPE data when I use oracle type4 driver
Hi,
I am using Oracle type-4 driver, My hibernet query returns null for data type XMLTYPE. But when I use BEA type -4 driver its working fine. Please help me to retrive XMLTYPE data using oracle-4 driver through hibernet query.
Thanks in advance.
regards,
AmareshHi,
I am using Oracle type-4 driver, My hibernet query returns null for data type XMLTYPE. But when I use BEA type -4 driver its working fine. Please help me to retrive XMLTYPE data using oracle-4 driver through hibernet query.
Thanks in advance.
regards,
Amaresh -
To add oracle spatial into my Oracle 10g database
Hi all,
I am using Oracle 10g 10.2.0.1.0 on Windows.
How to install Oracle spatial in my database.
I tried to do with DBCA with configure database option but in that Oracle spatial is in disabled state.
Please help I am newby to Oracle spatial
-Thanks & cheers
AntonyHi Antony,
is this a standard edition installation (or XE)?? Then spatial is not available - it's an EE option. Please see Note:465465.1 on Metalink (scroll down to the bottom of the table). IF it is an SE installation than you'd basically install a new Oracle Home with Spatial included, stop your database, restart it and run catalog/catproc (see Note:117048.1 on converting an SE to EE).
Kind regards
Mike -
Query form requires Logical operators and/or Quotes
In ORACLE 9I Jdeveloper beta I used the BC4J JSP wizard to create a - Query Form. The query form looks nice and runs except I have to also include the logical operators (= > <) and Quotes. For example to query on the name Joe I have to enter it as ="JOE". If I use JOE it gives me a JSP error. The error message shows the generated Select statment with the where clause JOE but is missing the "=" and quotes.
How do I hard code the "=" and quotes around strings so that the user doesn't have to?In ORACLE 9I Jdeveloper beta I used the BC4J JSP wizard to create a - Query Form. The query form looks nice and runs except I have to also include the logical operators (= > <) and Quotes. For example to query on the name Joe I have to enter it as ="JOE". If I use JOE it gives me a JSP error. The error message shows the generated Select statment with the where clause JOE but is missing the "=" and quotes.
How do I hard code the "=" and quotes around strings so that the user doesn't have to? -
Logical operators in Oracle select query
Hello all,
Can i use logical operators in oracle select queries?
for 1 and 0 =0 ; 1 or 0 =0
if i have two fileds in a table COL1 have a value of 1010 and COL2 have a value of 0001.
Is there any way to use select col1 or col2 from table? where or is a logical operator?
Regards,Hi,
NB wrote:
Hello all,
Can i use logical operators in oracle select queries?Sure; Oracle has the logical operators AND, NOT and OR. All the comparison operators, including >, >=, = !=, EXISTS, IN, IS NULL, LIKE and REGEXP_LIKE are really logical operators, since they return logical values. You can use them in SELECT statements, and other places, too.
for 1 and 0 =0 ; 1 or 0 =0
if i have two fileds in a table COL1 have a value of 1010 and COL2 have a value of 0001.It's unclear what you want. Maybe you'd be interested in the BITAND function:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/functions014.htm#sthref1080
BITAND is the only logical function that I know of. Many other functions, especially numberical fucntions such as MOD, have applications in logic.
Is there any way to use select col1 or col2 from table? where or is a logical operator?Whenever you have a question, please post a little sample data (CREATE TABLE and INSERT statements), and also post the results you want from that data.
Explain how you get those results from that data.
Always say which version of Oracle you're using. -
Logical operators using "AND" and "OR" operators
I currently have written code which has two for loops to search a user query. I am able to search user queries entered for a simple and composed query. Eg. Simple query can be "Hello" and composed query can be "Hello World".
What i would like to do now is be able to use logical operators such as "AND", "OR" when searching e.g. "Hello AND World" or "Hello OR World" Once this is done i would like to score the highest point depending on where the query is found.
Could someone please help me with either giving me some tips of going about this or some starting code and hints. I have attached some code below which explains what i am currently doing to do the simple query.
private void SearchButtonActionPerformed(java.awt.event.ActionEvent evt) {
/* Gets the simple query enterted into the text field. It then looks at the strippedFile in memmory */
long start = System.currentTimeMillis();
// long elapsed = System.currentTimeMillis() - start;
String userQuery = SearchTextField.getText();
StringTokenizer userQ = new StringTokenizer(userQuery);
String[] brokenStrings = new String[userQ.countTokens()];
int counter2 = 0;
while (userQ.hasMoreTokens()) {
String moreStrings = userQ.nextToken();
brokenStrings[counter2] = moreStrings;
counter2++;
int Simplematches = 0;
for (int i = 0; i < strippedFile.length; i++) {
String LongCurrentLine = strippedFile;
StringTokenizer st = new StringTokenizer(LongCurrentLine);
String[] currentline = new String[st.countTokens()];
int counter = 0;
while (st.hasMoreTokens()) {
String moreStrings1 = st.nextToken();
currentline[counter] = moreStrings1;
counter++;
highlighter.highlight(HTMLOutputTextArea, userQuery);
for (int j = 0; j < brokenStrings.length; j++) {
for (int k = 0; k < currentline.length; k++) {
if (brokenStrings[j].equalsIgnoreCase(currentline[k])) {
long elapsed = System.currentTimeMillis() - start;
Simplematches++;
String output = "\"" + currentline[k] + "\" was found on line " + (i + 1) + "." + " At postion " + (k + 1) + " and took " + elapsed + " milliseconds." + " Found " + Simplematches + " matches" + "\n";
//String output = "\"" + currentline[k] + "\" was found on line " + (i + 1)+ "." + " At postion " + (k + 1) + " Found "+ Simplematches+ " matches"+ "\n";jschell wrote:
london_guy86 wrote:
jschell wrote:
Not clear what you search, but....
First you need to specifically define the syntax. For example what does the following mean?
a OR b AND c OR d
Once you do that then you parse the input to create an expression tree. Then you write an interpreter to run the expression tree.Is there any chance you could give me a starter code or soe sources i could look at. I really dont understand how to go about doing what you have mentioned. As in i have declared the syntax at the moment and i am then using the replaceAll() and calling in what i have declared. with empty strings.
Is this what you mean?Hard to say since I don't understand your statement.
There are three parts
1. Parse the expression.
2. Interpret the expression
3. Do the "search", this is actually part of 2 however it should be possible to implement some or all of it separate from 1 and 2.
Do NOT mix the three parts until you are ready to mix them.
Your posted code is mixing them.
Presumably what you posted is mostly search. So to start re-write JUST the search code as a class.
However you can't really do that until you define what the expressions do.After doing everything you mentioned do you think it would be hard to get a score on the best match search found?
If not could you also give me some tips towards that if you know any.
Thanks -
Search format with logical operators in TREX
We've activated the index for business object BUS1001006 for material master on SES_ADMIN. The index was created successfully and the two new search help was activated as well. Now testing it in development, I'm trying to figure out how you include logical operators (AND, OR, etc...) inside your search term.
For example I want to search materials that has ADAPTOR or AMPLIFIER. If I specify exactly "ADAPTOR or AMPLIFIER" (without the quotes) it does not return any search results.
I'm trying this both on the two new search help and on program COM_SE_SEARCH_IIF_TEST.
Can you let me know how to do this please ?
Thanks in advance.You have to distinguish between attribute search and full text search:
In attribute search you can use logical operators by using the generic Select Options just like in any other search help.
In full text search all entered search words are interpreted with AND conditions.
If you just press the generic F1 for help on the field "Full Text Search" you will receive the complete standard documentation.
OR conditions in full text search are not supported because of the restrictions of the generic F4 UI.
If you want to support OR conditions you should consider installing the SAP product NetWeaver Enterprise Search. The full text search in it's generic search UI contains a query parser that supports the following (and more) features:
[http://help.sap.com/saphelp_nwes72/helpdata/en/d0/297dfa25a24a57a31e8364ee2ad7eb/frameset.htm]
Instead of contructing OR conditions it's sometimes much more convenient to browse with NetWeaver Enterprise Search through the distinct value lists of attributes: Read "Narrowing Down Results" in:
[http://help.sap.com/saphelp_nwes72/helpdata/en/df/f2fb01b6844246b121497b633d83a5/frameset.htm]
Enjoy! - Klaus -
Spatial Query, Use Multiple Cores
Basic question, is SQL 2012 running on Windows 2008 R2 64 bit expected to use multiple cores to execute it's tasks?
I have a table of points, 480, that has 3 empty columns that are being updated from 3 separate tables of polygons via a spatial join based on an intersection (STIntersects) of the point and polygons. All of the data is in 4326 and all tables have spatial
indexes.
The server running this query has 32 logical cores, but only 1 core is used and it is maxed out. It takes 53 seconds to complete the update. I have over a million points that need this done. I want to assume that if SQL can access more cores it will complete
faster.
I've looked at the actual execution plan and there is a 99% cost on the spatial query.
update A
set CONGRESS_DISTRICT = B.DISTRICT, HOUSE_DISTRICT = C.DISTRICT, SENATE_DISTRICT = D.DISTRICT
from [LegislativeMapData2014].[dbo].[CNRM_INFORCE_EXTRACT093014_COMBINED_GEOCODED] A
inner join [LegislativeMapData2014].[dbo].[CONGRESS_2014] B
on A.FEATURE_SHAPE.STIntersects(B.FEATURE_SHAPE) = 1
inner join [LegislativeMapData2014].[dbo].[HOUSE_2014] C
on A.FEATURE_SHAPE.STIntersects(C.FEATURE_SHAPE) = 1
inner join [LegislativeMapData2014].[dbo].[SENATE_2014] D
on A.FEATURE_SHAPE.STIntersects(D.FEATURE_SHAPE) = 1
Is there anything I can do to improve the performance of the query? Do I need to hint the indexes? Or something else?
ThanksHi,
updating millions of records could lock your resource and other users may have trouble connecting or reading data.
In some cases, variable table is your friend, insert the data you needed to a variable table before issuing the update.
with that, you may need to have (nolock) on each table. eg.
[LegislativeMapData2014].[dbo].[CONGRESS_2014] (nolock)
Regards,
gioVhan
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
Spatial query to find all partially aligned lines
Hi There.
I need to find all partially aligned polylines in the layer (interiors have 1-dimentionali intersection). Actually, polylies may a little fluctuate along each other, but that spatial disjointment shouldn't exceed some certain tolerance. It doesn't matter if polylines are touching each other or cover.
What spatial operators/functions will you suggest to use to perform that stuff?
For example next lines for me are partially aligned in tolerance 0.01 (query result is TOUCH):
select sdo_geom.relate(
mdsys.sdo_geometry(2002,null,null, mdsys.sdo_elem_info_array(1,2,1), mdsys.sdo_ordinate_array(1,1,4,4)),
'determine',
mdsys.sdo_geometry(2002,null,null, mdsys.sdo_elem_info_array(1,2,1), mdsys.sdo_ordinate_array(1.1,1,3.015,3)),
0.01) relationship
from dual;
Note: I can't use buffers because it isn't stable for me :( see: SDO_GEOM.SDO_BUFFER failed with ORA-13050
Thank you in advance, Denis.Thank you for quick response!
The lines are valid at that tolerance.
I think that TOUCH+COVERS+COVEREDBY will not be sufficient for me. Because I'm interested in next cases: OVERLAPBDYINTERSECT, INSIDE, CONTAINS, COVERS (any operator which includes overlapping for lines). I can use union of all those masks, but TOUCH will return me many redundant candidates (Often lines are touch but not overlapping, like: (1,1,2,2) VS (2,2,3,3)). The TOUCH works for me if one poliline touches the other and goes along it some time (like I showed above). Hope I was clear :). -
Spatial Query - sdo_aggr_union
Hi
I am a newbie to oracle spatial (Database 11g) and am having an issue with sdo_aggr_union
i have the following cursor
CURSOR get_buffer_union IS
SELECT sdo_aggr_union(sdoaggrtype(coverage,0.5)) coverage
FROM
(SELECT sdo_aggr_union(sdoaggrtype(coverage,0.5)) coverage
FROM
(SELECT sdo_aggr_union(sdoaggrtype(coverage,0.5)) coverage
FROM
(SELECT sdo_aggr_union(sdoaggrtype(coverage,0.5)) coverage
FROM
(SELECT sdo_aggr_union(mdsys.sdoaggrtype(geom,0.5)) coverage
FROM rep_geo_acc_buffer
where extraction_date = trunc(sysdate)
GROUP BY mod(rownum,128))
GROUP BY mod (rownum, 32))
GROUP BY mod (rownum, 8))
GROUP BY mod (rownum, 2)
The result i am getting back is null. If I run the inner statement i get back 128 rows. Is it possible that this result is being held in cache and this is not the true result or is there someting wrong with the query.Wellcome to OTN Forums!
Why you are using GROUP BY inner GROUP BY?
What is your logic?
CURSOR get_buffer_union IS
SELECT sdo_aggr_union(sdoaggrtype(coverage,0.5)) coverage
FROM
(SELECT sdo_aggr_union(sdoaggrtype(coverage,0.5)) coverage
FROM
(SELECT sdo_aggr_union(sdoaggrtype(coverage,0.5)) coverage
FROM
(SELECT sdo_aggr_union(sdoaggrtype(coverage,0.5)) coverage
FROM
(SELECT sdo_aggr_union(mdsys.sdoaggrtype(geom,0.5)) coverage
FROM rep_geo_acc_buffer
where extraction_date = trunc(sysdate)
GROUP BY mod(rownum,128))
GROUP BY mod (rownum, 32))
GROUP BY mod (rownum, 8))
GROUP BY mod (rownum, 2)
);
Maybe you are looking for
-
How do I bring up my Itunes library from my PC to my new MAC?
How do I bring up my Itunes library from my PC to my new MAC?
-
Battery draining very fast on MacBook Pro
Just in the past month my battery has started to drain unusually fast. It will go from 100% to less than 20% in 3 hours. Most of the time the only programs I am using are Microsoft Word and Safari (thus, wi-fi), but even if I am not actively using
-
I searched for an answer but couldn't find one, so here goes. I'm editing 640x480 avi files I took with my digital camera for a 4:3 tv. When I export video footage (Export>Quicktime Movie) the final movie is in 720x480. When I burn it to a DVD it loo
-
Assigning sequential numbers for every lines within a group of records
The scenario is: This set of records with group number, lets say 100(group number) contains 7 lines/records. How to assign line numbers (sequential) for each line within these groups on the fly during the mapping process before inserting these set of
-
Designer6 pre-configured repository on 8iEE 8.1.6(Win NT)
Hello All!, My environment is : WinNT4.0 with SP3 Des6.0 on D:\Orant with default_home Dev6.0 on D:\Orant with default_home 8iEE 8.1.6 on G:\ora8i with 8i_home Now, How can a install the Des6.0 pre-configured repository? The 2nd CD(pre-config reposit