URGENT Select Query Returning No Records take same time as that of insert
Hello Everrybody,
I am facing a wierd problem...
I have table with 15 fields and I am selecting a record with some condition...
for e.g
select field1,field2,field3....... from tablea where field1=123
Now I have index on field1
When I do SQL Trace it show me time taken as
00:00:00:60 in oracle 817 SQL PLUS
and using
oracle 92 sql plus it show as
00:00:00:01 in oracle 817 SQL PLUS
Now Query is what does this 60 denotes milliseconds or what in oracle 92 and in oracle 817 sql plus.....
Also this query does not return any rows...
When I run the SP that insert records in same table...That sp take about same time as that of select returning no rows......
Why is ORACLE Taking so much time for that select ????
Please help.....
8i measures timings in 100th of a second but I believe that 9i measures stuff in 1000th of a second. However, from your output it looks like SQL*Plus trace is rounding up to the nearest centisecond.
Time is a very poor way of judging performance when you're talking less than a second per operation. You'd be better off looking at CPU usage and IO activity.
Anyway, here are some questions for you to research:
(1) Is field1 a unique index?
(2) How many rows does this table hold?
(3) How fresh are the statistics on the table and the index?
(4) What's the explain plan? What's the TKPROF output?
(5) Are all of the above the same on both databases?
Cheers, APC
Similar Messages
-
Using index in a query return few records than full table access
Today we have an issue with a query, when it use the ok index the returned are not all records that apply to where clause condition.
See bellow
explain plan for
select * from movdb.zan_m03 where
M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
M00za = 10 AND
m00AC = 50 AND
M00AD between 136906 and 136999
SELECT * FROM TABLE(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 1882720105
| Id | Operation | Name |
| 0 | SELECT STATEMENT | |
| 1 | TABLE ACCESS BY INDEX ROWID| ZAN_M03 |
|* 2 | INDEX RANGE SCAN | PK_ZAN_M03 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
2 - access("M00AF"=TO_DATE('11/01/28','YY/MM/DD') AND "M00ZA"=10 AND
"M00AC"=50 AND "M00AD">=136906 AND "M00AD"<=137141)
filter("M00AD"<=137141 AND "M00AD">=136906)
Note
- rule based optimizer used (consider using cbo)
20 rows selected.
The query above return only one row insted 1579 record that apply to this conditions.
When forcing a full table acess with a hint, the query return all records that apply, the 1579 record.
select /*+ FULL(zan_m03) */ M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
M00za = 10 AND
m00AC = 50 AND
M00AD between 136906 and 137141
Can you help me to identify what's happening?
I am with Oracle 10g R2 10.2.0.4 standard edition
the statistics are up to date
the opitimizer_mode are rule, but altering in session level to all_rows happens the same issue.
Nothing about corruption in the alert log.
Thanks in advance
Regards
CristianoYes the query are the same and correct restriction for where clause are M00AD between 136906 and 137141.
I've pasted, by mistake, another test query
The corrects are:
select M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
M00za = 10 AND
m00AC = 50 AND
M00AD between 136906 and 137141
This use pk index and return one row
select /*+ FULL(zan_m03) */ M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
M00za = 10 AND
m00AC = 50 AND
M00AD between 136906 and 137141
This does a full table access and return 1579 records
I´ve been searching for wrong results bugs on my oracle support, but not found one that mentions something like our issue.
I checked the dba_tables and dba indexes and the number of rows are different, and I think this would be the same because it's is a pk.
Look this
SQL> select NUM_ROWS from dba_tables where table_name = 'ZAN_M03'
2 /
NUM_ROWS
228527878
select NUM_ROWS from dba_indexes where index_name = 'PK_ZAN_M03';
SQL> select NUM_ROWS from dba_indexes where index_name = 'PK_ZAN_M03';
NUM_ROWS
217510185
Is normal a index for pk having much fewer rows than table? I think not, but not sure.
Again
Thanks in advance
Regards
Cristiano -
Urgent! Display lookup value and return value at the same time.
We are using pop up lov.
How can we display lookup value and return value at the same time. let me claer..
Our lov query is like fallowing
select dname, deptno from dept
we want to return deptno column into a database bind text item and dname column into a display item (look up)
can we do it (we need to do)
thanks for your help.We did it .
But pop up key lov (display description return value ) property doesn't appear for tabular forms item.
(Report Attributes pages Tabular Form Element section display As property list)
can we set or not.
Thank you. -
In Logic 9, is there any way of editing the take folders of, say, 7 different drum tracks at the same time, so that each track has the same changes applied to its takes?
scottiewade wrote:
Thanks. I know how to select multiple tracks in the mixer, did that and put on group clutch,
Hi
Wrong..
To assign tracks to a group, click in the dark gray box just above the automation (Read/Write/Off etc) on a channel strip, and select the group number you wish to use. The first tim eyou assign a group, the Group Setting swindow will appear automatically, thereafter you need to click on the group area and choose 'Open Group Settings'.
Make sure that you have turned off Group Clutch (this disables all Groups)
Maybe this will help
http://support.apple.com/kb/VI248
CCT -
Does commit work (commiting the changess to database take same time for ..
Does commit work (commiting the changess to database )take same time for one record and 1000 records
Hi ,
There is some micro seconds differences in updating the recors . If you have huge records ,split the data into parts and insert it .
To avoid errors or warnings ,you can use 'WAIT UPTO 5 SECONDS ' .
Thanks
Jagadeesh.G -
Hi !
I have Dreamweaver 8
I've tried to select several css rules at the same time to create a css style sheet but i don't know how to do it !
This man do it in this video at 3:00
http://www.youtube.com/watch?v=ZbQ3GTFC-o0
Thanks !DW8 doesn't support the selection of multiple classes in the properties panel. I'm pretty sure that feature didn't appear until the release of CS6. Unless you upgrade to CS6 or CC, you must do it manually in your code.
Nancy O. -
Basically I want to combine to clips with correct timings. For that I want to view the two clips overlapping each other, each being semitransparent to see both at the same time, so that I can decide where to stop of the first clip and start of the second clip? Thanks.
see my reply in your other post:
You're familiar with the TRIM-tool?
http://help.apple.com/finalcutpro/mac/10.1/?lang=en#ver1632caff
http://help.apple.com/finalcutpro/mac/10.1/?lang=en#ver1632d8e4
http://help.apple.com/finalcutpro/mac/10.1/?lang=en#ver1632d9ae -
my ipad will not let me slide to log in, or power off. I have tried to hold down the sleep and home button at the same time, but that did not work. D o you have any tips for me? Thanks.
recovery mode
open itunes on computer
plug cable into computer not iOS device
turn phone off
hold home button and plug cable into phone. do not release home button until an itunes graphic appears on device.
look to computer should have message about recovery mode click ok and restore
Peace, Clyde
if u need an article see
http://support.apple.com/kb/HT1808 -
If Two Users try to schedule a report at the same time does that lead to a Deadlock?
When Two users trying to access the same server and need to access the report for scheduling at the same time, does that lead to Deadlock Situation?
What are the Odd's in such scenarios?
Please help me understanding.
Regards,
ShivaWhen two users are say trying to schedule the same report at the same time - the relevant Job server has default capacity of running 5 concurrent jobs at a time (this value can be increased) - that means, it can run 5 schedules at the same time.
Let's say now two users have scheduled 6 reports - now the 5 reports that were scheduled will be in the "running" state but the server has only 5 concurrent job capacity so the 6th report schedule will stay "pending" until any one of the existing jobs are completed, and then the 6th report will start "running".
There is nothing called deadlock while scheduling. While viewing the reports, there are enough resources available in the BO system to make the report available for various users at the same time.
Thank you, Rahul -
Hello i opened logic 9 and logic x at the same time after that i lost audio in both programs i can only hear audio in the main output of my interface motu 828MKII
can somebody help me please? am in the middle of o project thank'sDid you reset Logic's audio preferences?
Did you do a hardware reset of the MOTU unit?
Try deleting preferences in Logic X
See my post in this message.
https://discussions.apple.com/message/24614057#24614057 -
Hi all
I want to fetch just twenty thousands records from table. My query take more time to fetch twenty thousands records. I post my working query, Could you correct the query for me. thanks in advance.
Query
select
b.Concatenated_account Account,
b.Account_description description,
SUM(case when(Bl.ACTUAL_FLAG='B') then
((NVL(Bl.PERIOD_NET_DR, 0)- NVL(Bl.PERIOD_NET_CR, 0)) + (NVL(Bl.PROJECT_TO_DATE_DR, 0)- NVL(Bl.PROJECT_TO_DATE_CR, 0)))end) "Budget_2011"
from
gl_balances Bl,
gl_code_combinations GCC,
psb_ws_line_balances_i b ,
gl_budget_versions bv,
gl_budgets_v gv
where
b.CODE_COMBINATION_ID=gcc.CODE_COMBINATION_ID and bl.CODE_COMBINATION_ID=gcc.CODE_COMBINATION_ID and
bl.budget_version_id =bv.BUDGET_VERSION_ID and gv.budget_version_id= bv.budget_version_id
and gv.latest_opened_year in (select latest_opened_year-3 from gl_budgets_v where latest_opened_year=:BUDGET_YEAR )
group by b.Concatenated_account ,b.Account_descriptionHi,
If this question is related to SQL then please post in SQL forum.
Otherwise provide more information how this sql is being used and do you want to tune the SQL or the way it fetches the information from DB and display in OAF.
Regards,
Sandeep M. -
Query returns zero records in coldfusion context, but works fine in Navicat
I've got a query that's returning zero records when I load a page. If I copy and paste that same query (from the debug output) into navicat, I get rows returned (as I expect). Has anyone seen this? It happens locally (CF9) AND remotely on our staging server (CF10). Even weirder, it's a query that was previously working fine - I simply added an if statement to the where clause, and all of a sudden...
Here's the query:
<CFQUERY name="LOCAL.getEncounterServices" datasource="#REQUEST.dsn#">
SELECT
a.EncounterProductID,
a.DateTime AS ServiceDate,
aa.CartItemID,
aaa.CartID,
aaaaa.CartStatus,
b.ProductID,
b.ProductName,
b.CPTCode,
b.Price,
c.EncounterID,
c.DateTimeClosed AS EncounterClosedDate,
d.FirstName,
d.LastName
FROM
EncounterProducts a
LEFT JOIN CartItemProduct aa ON (a.EncounterProductID = aa.EncounterProductID AND aa.Active = 1)
LEFT JOIN CartItem aaa ON (aa.CartItemID = aaa.CartItemID)
LEFT JOIN Cart aaaa ON (aaa.CartID = aaaa.CartID)
LEFT JOIN CartStatus aaaaa ON (aaaa.CartStatusID = aaaaa.CartStatusID),
Product b,
Encounters c,
Contacts d,
EncounterStatuses e
WHERE
1 = 1
AND (aa.CartItemID IS NULL OR aaaaa.CartStatus = 'Deleted')
AND a.Active = 1
AND a.ProductID = b.ProductID
AND a.EncounterID = c.EncounterID
AND c.PatientID = d.ContactID
AND c.EncounterStatusID = e.EncounterStatusID
AND e.EncounterStatus = 'Closed'
<CFIF IsDefined("ARGUMENTS.encounter") AND IsObject(ARGUMENTS.encounter)>
AND c.EncounterID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.encounter.getID()#">
<CFELSE>
AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
</CFIF>
AND c.LocationID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.locationID#">
AND c.CustomerID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.customerID#">
</CFQUERY>
All of this worked just fine before I added the lines:
<CFIF IsDefined("ARGUMENTS.encounter") AND IsObject(ARGUMENTS.encounter)>
AND c.EncounterID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.encounter.getID()#">
<CFELSE>
AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
</CFIF>
Previously, it had just been:
AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
With no IF/ELSE statement.
Anyone seen anything like this before? Any ideas?
Thanks.Right, I'll start disabusing myself of the DateFormat!
I'm sorry, I should've posted the actual query too. It's inserting the first part - "AND c.EncounterID = ....."
Here's the full query:
LOCAL.getEncounterServices (Datasource=xmddevdb, Time=9ms, Records=0) in /Applications/ColdFusion9/wwwroot/XMD_NEW/xmd_dev/cfc/ShoppingGateway.cfc @ 16:56:28.028
SELECT
a.EncounterProductID,
a.DateTime AS ServiceDate,
aa.CartItemID,
aaa.CartID,
aaaaa.CartStatus,
b.ProductID,
b.ProductName,
b.CPTCode,
b.Price,
c.EncounterID,
c.DateTimeClosed AS EncounterClosedDate,
d.FirstName,
d.LastName
FROM
EncounterProducts a
LEFT JOIN CartItemProduct aa ON (a.EncounterProductID = aa.EncounterProductID AND aa.Active = 1)
LEFT JOIN CartItem aaa ON (aa.CartItemID = aaa.CartItemID)
LEFT JOIN Cart aaaa ON (aaa.CartID = aaaa.CartID)
LEFT JOIN CartStatus aaaaa ON (aaaa.CartStatusID = aaaaa.CartStatusID),
Product b,
Encounters c,
Contacts d,
EncounterStatuses e
WHERE
1 = 1
AND (aa.CartItemID IS NULL OR aaaaa.CartStatus = 'Deleted')
AND a.Active = 1
AND a.ProductID = b.ProductID
AND a.EncounterID = c.EncounterID
AND c.PatientID = d.ContactID
AND c.EncounterStatusID = e.EncounterStatusID
AND e.EncounterStatus = 'Closed'
AND c.EncounterID = ?
AND c.LocationID = ?
AND c.CustomerID = ?
Query Parameter Value(s) -
Parameter #1(cf_sql_integer) = 28
Parameter #2(cf_sql_integer) = 16
Parameter #3(cf_sql_integer) = 6
Thansk again for the help! -
Search query returning ALL records
DW CS3 - MS Access - ASP/VBScript
I have a search form for records to display on the same page with keywords highlighted. The search is returning ALL records and highlighting keywords throughout rather than returning specific records with the searched word. What am I missing? I'm sure it's something terribly simple.....
<input name="search" type="text" id="search" value="<%= Request.QueryString("search") %>" />
SELECT item, item, item, item
FROM tbl_name
WHERE item OR item OR item LIKE %MMColParam%
ORDER BY sql_orderby, Date DESC
Name: MMColParam
Type: Text
Value: Request.Querystring("search")
Default Value: %I was using the word "item" as an example for multiple columns without actually naming them - they are not the same. I should've used this example:
SELECT shoes, socks, hats, gloves
FROM tbl_apparel
WHERE shoes OR socks OR hats LIKE %MMColParam%
ORDER BY sql_orderby, Date DESC
In the past, I had four duplicate query parameters for four columns which worked fine. But since I only have one search term, I thought I could eliminate three of the duplicate parameters and use just one with the OR statement.
In the past, you questioned me on this. You stated, "You only have one search term and so all of the parameters have the same value, but DW still wants to creates 4 parameters. If you were coding this by hand you wouldn't do it that way, but DW's one-size-fits-all code generates four seperate parms. It's nothing to worry about." -
Can select statement return 'No Record found' for each of invalid inputs.
Let say when you select a invalid booking number, oracle will
return nothing, but do u know how to make oracle return a record
saying it's invalid?
Example, the following sql normally return 3 records cause
only 3 numbers are valid, is there anyway to make it return
4 records and indicate those invalid ones are invalid somehow.
select booking_service, BOOKING_NO from tb_booking where booking_no in ('valid1','INVALID', 'valid2', 'valid3')Along the same lines you could use object types to achieve the same result. This would remove the need for a temporary table, and also allow you to create the list of ids to check with PL/SQL without i/o. As an example
CREATE TYPE booking_id_typ IS OBJECT (id NUMBER);
CREATE TYPE booking_id_list_typ IS TABLE OF booking_id_typ;
CREATE TABLE bookings (booking_id booking_id_typ);
(you could have booking_id as type NUMBER, but for consistency with subsequent SQL I've used booking_id_typ)
INSERT INTO bookings VALUES (booking_id_typ(10));
INSERT INTO bookings VALUES (booking_id_typ(20));
INSERT INTO bookings VALUES (booking_id_typ(40));
INSERT INTO bookings VALUES (booking_id_typ(50));
The following SQL statement creates a collection on the fly, rather than using an IN clause.
SELECT i.id booking_id, DECODE(b.booking_id.id, NULL, 'Invalid', 'Ok') status
FROM bookings b,
SELECT id
FROM TABLE(booking_id_list_typ(booking_id_typ(10), booking_id_typ(20), booking_id_typ(30), booking_id_typ(40)))
) i
WHERE i.id = b.booking_id.id (+)
BOOKING_ID STATUS
10 Ok
20 Ok
30 Invalid
40 Ok
This SQL statement works in 9i. I get the following error in 8i, but you might be able to CAST the TABLE to booking_id_list_typ, or depending on your application, create a PL/SQL variable of type booking_id_list_typ and CAST that instead.
ERROR at line 5:
ORA-22905: cannot access rows from a non-nested table item -
Sinlge select query in different schemas for same table(Indentical Structu)
Scenario :
Table XYZ is created in Schema A
After an year, the old data from the previous year would be moved to different schema. However in the other schema the same table name would be used.
For eg
Schema A contains table XYZ with data of 2012 yr
Schema B contains table XYZ with data of 2011 yr
Table XYZ in both the schemas have identical structure.
So can we fire a single select query to read the data from both the tables in effective way.
Eg select * from XYZ where date range between 15-Oct-2011 to 15-Mar-2012.
However the data resides in 2 different schema altogether.Thanks for the reply
Creating an view is an option.
But my problem, there is ORM layer(either Hibernate or Eclipse Top Link) between the application and the database.
So the queries would be formed by the ORM layer and are not hand generated.
So i cannot use view.
So is there any option that would allow me to use single query on different schema's ?
Maybe you are looking for
-
Wifi on Surface Pro - installed with ndiswrapper but not working
Hi there guys. I have installed Arch on a Surface Pro and most things work well. The biggest problem so far is wifi - it comes with a 88w8797 Marvell Avastar chipset. I managed to find the drivers and used ndiswrapper to install them. $ ndiswrapper -
-
help me
-
Dual boot CentOS and Windows 7
Hello, I am looking for such solutions wherein I can have CentOS as a dual boot along with WIndows 7. I tried searching for resources and found the following link very helpful. http://www.techotopia.com/index.php/Installing_CentOS_6_with_Windows_in_a
-
MacBook Pro 10.6.8 Hard Drive Issues
I ordered a new hard drive (The exact same) for my macbook pro and here is what happend. When I boot from the CD and I get to the Utility panel I don't see my hard drive, it is not listed under Disk Utility nor under the selec area. I have rester the
-
Error in Portal Navigation - Font Type, Size and formatting.
We carry through all the tips postadas in the SDN to solve this problem, however we the same have some different stations with problem. We are using the Bi 7,0 Portal, and we are with problems in the layout: <b>Font Type, Size and formatting</b>, and