Question of understanding MaxDB 7.6.36 & select count (*)
Hi all,
we do a
SELECT
COUNT(*)
FROM
"/BIC/FTABLE"
which lasts very long in my opinion.
The explain shows an index scan with an only index access and a high pagecount.
TABLENAME COLUMN OR INDEX STRATEGY PAGECOUNT
/BIC/FTABLE /BIC/FTABLE~02 INDEX SCAN 79669
ONLY INDEX ACCESSED
SHOW RESULT IS COPIED, COSTVALUE IS 79671
The file directory counter entries for the table do exist, so why is this access so slow?
Anybody any idea?
Thank you.
Best regards
Christian
Hi Ashwath,
the Version of MaxDB is 7.6. Build 36 as stated in subject
The operating system is SuSe Linux 9 PL 3 64 Bit.
Hi Lars,
yes we are SAP user, the statement was generated in SCM5.0 and directly taken from command monitor using the explain function within DB50.
By the way ... in DB50 the statement is first shown as
SELECT
COUNT(*) INTO ?
FROM
"/BIC/FTABLE"
but the explain shows the statment as
SELECT
COUNT(*)
FROM
"/BIC/FTABLE"
maybe there could be a difference...
So there is no MANDT in the where clause which could be the reason for this.
If I am right you say, that a select count (*) always uses an index access? Why doesn't use MaxDB the file directory counter? Thats what I expected.
Best regards
Christian Götze
Similar Messages
-
"select count(*)" and "select single *" returns different result
Good day!
product version SAP ECC 6.0
oracle10
data transfers from external oracle db into customer tables using direct oracle db link
sometimes I get case with different results from 2 statements
*mytable has 10 rows
*1st statement
data: cnt type I value 0.
select count( * ) into cnt from mytable WHERE myfield_0 = 123 and myfield_1 = '123'.
*cnt returns 10 - correct
*2nd statement
select single * from mytable WHERE myfield_0 = 123 and myfield_1 = '123'.
*sy-dbcnt returns 0
*sy-subrc returns 4 - incorrect, 10 rows are "invisible"
but
1. se16 shows correct row number
2. I update just one row from "invisible" rows using se16 and 2nd statement returns correct result after that
can not understand why
thank you in advance.Thank you, Vishal
but,
general problem is that
1. both statements have the same WHERE conditions
2. 1st return resultset with data (sy-dbcnt=10), 2nd return empty dataset, but must return 1 in sy-dbcnt
Yes, different meaning, you are right, but must 2nd must return 1, because of "select single *" construction, not 0.
Dataset to process is the same, WHERE conditions are equal...
I think the problem is that how ABAP interperets select count(*) and "select single *".
Maybe "select count (*)" scans only PK from index page(s)? and "select single *" scans data pages? and something is wrong with that?
I'm new in SAP and didn't find any SAP tool to trace dump of data and indexes pages with Native SQL.
se16 shows all records.
And why after simple manual update of just one record using se16 "select single *" returns 1?
I've just marked one row to update, didn't change any data, then pressed "save". -
Sub-Select Count query breaking TOAD
Oracle 10.2.0.4.0
Running TOAD 9.1
I am running some SQL on our eBusiness Suite:
SELECT pha.segment1
, pha.type_lookup_code
, (SELECT COUNT(DISTINCT pha2.po_header_id)
FROM po.po_headers_all pha2
, po.po_lines_all pla
WHERE pha2.po_header_id = pla.po_header_id
AND pla.contract_id = pha.po_header_id) po_count
, (SELECT MAX(pha2.creation_date)
FROM po.po_headers_all pha2
, po.po_lines_all pla
WHERE pha2.po_header_id = pla.po_header_id
AND pla.contract_id = pha.po_header_id) latest_cpa_po
FROM po.po_headers_all pha
, po.po_vendors pv
, po.po_vendor_sites_all pvsa
WHERE pha.vendor_id = pv.vendor_id
AND pha.vendor_site_id = pvsa.vendor_site_id
-- AND pv.VENDOR_NAME LIKE 'H%'
AND pha.vendor_id = 98
AND pha.type_lookup_code = 'CONTRACT'
AND pha.org_id IN(7041, 7042);The above query runs quicky (approx. 1 second). If I take out the AND pha.vendor_id = 98 then the query takes a few minutes to run.
When I try to export it, or scroll down to view > 500 rows, TOAD crashes.
I know this isn't a TOAD forum, but I think that this is probably an issue with my no doubt rubbish SQL.
If I take out this sub-select, then the problem doesn't happen:
, (SELECT COUNT(DISTINCT pha2.po_header_id)
FROM po.po_headers_all pha2
, po.po_lines_all pla
WHERE pha2.po_header_id = pla.po_header_id
AND pla.contract_id = pha.po_header_id) po_countHowever, I can't work out a better way of getting the data I need.
The sub-select counts POs which have been raised where the contractID on the PO line is the same as the PO Header ID from the main query.
Any advice please, on what I could do to sort this out would be much appreciated.
Thanks!Hi,
It looks like you can replace both scalar sub-queries with a join, like this:
WITH header_lines_summary AS
SELECT pla.contract_id
, COUNT (DISTINCT pha2.po_header_id) AS po_count
, MAX (pha2.creation_date) AS latest_cpa_po
FROM po.po_headers_all pha2
, po.po_lines_all pla
WHERE pha2.po_header_id = pla.po_header_id
GROUP BY pla.contract_id
) -- Everything up to this line is new
SELECT pha.segment1
, pha.type_lookup_code
, hls.po_count -- Changed
, hls.latest_cpa_po -- Changed
FROM po.po_headers_all pha
, po.po_vendors pv
, po.po_vendor_sites_all pvsa
, header_lines_summary hls -- New
WHERE pha.vendor_id = pv.vendor_id
AND pha.vendor_site_id = pvsa.vendor_site_id
AND pha.po_header_id = hls.contract_id (+) -- New
-- AND pv.VENDOR_NAME LIKE 'H%'
AND pha.vendor_id = 98
AND pha.type_lookup_code = 'CONTRACT'
AND pha.org_id IN (7041, 7042);Aside from the sub-query (which is entirely new), the query above is just what you posted, with 2 lines changed and 2 lines added, as marked.
This should be more efficient, but I don't know for certain that it will solve the Toad problem.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
It never hurts to say what version of Oracle you're using. -
Select count into versus create table as in functions/procedures
I am working on a dynamic PL/SQL script that will count the number of records in a remote database
based on certain criteria and then if the number is "acceptable" will create a table in the connecting
database with those records.
My where clauses are supposed to be the same but I am presented with the problem, when I run the
first code ... select in to rowcount I get 122000 records, when I later do the create table as
with the same whereclause code, I get 77 records. So now I am attempting to validate that the two
where clauses are the same ... you'd think it would be obvious, but it's not.
My first operation does a select count(*) into rowcount with the where clause behind it.
The second operations creates a "sql command literal' that gets executed and returns the less value.
I build it like testscript := 'create table '||tablename ||'as select * from '||remotetablename||'@'||linkname;
testwhere := ' xxxxxxx'
then I do an execute immediate teststring ||' ' testwhere; which works but gives me 77 rows in the table.
Since I believe my where clause might be different, how can I run the first operation ... select count into rowcount
as a normal SQL statement in the script...
When I attempt to just run it I get -- PLS-00428: an into clause expected in this select statement......
I will provide the source code in my next posting. Working to get it moved to this system.. Once you see it you'll understand
why I don't think, it's the same, but I need a way to run them exactly as they are written to understand the different results.
so How can I make the select count (*) into rowcount from .... work just like a normal selectHere is first part of the procedure --- I get returned value of 122000 records ....
SELECT COUNT (*)
INTO ROWCOUNT
FROM A_K_A_D_TBL@FCA08_INGRES
WHERE (( "a_" = '1' OR "a_" = '6' ) AND
( "d_t" <> '3' OR "k_c_s" = 'Y' ) AND
"d_d" < DATECUTOFFDATE AND
"k_c_d" < DATECUTOFFDATE )OR
(( "a_" = 4 OR "a_" = 7 ) AND
( "d_t" <> '3' OR
"k_c_s" = 'Y' OR
"r_t" = '0' OR
"r_t" = '2' OR
"r_t" = '3' ) AND
"d_d" < DATECUTOFFDATE AND
"k_c_d" < DATECUTOFFDATE AND
"r_d" < DATECUTOFFDATE AND
"s_d" < DATECUTOFFDATE);
then I attempt to duplicate it for string literals.... when this runs ... I get only 77 records. So that makes me think that my strings are not
done properly.
So I want to try to run the first sql itself ... but then I get the errors about needing select into ..... etc..
TESTWHERE := q'[WHERE (( "a_" = '1' OR "a_" = '6' ) AND ( "d_t" <> '3' OR "k_c_s" = 'Y' )]'||
q'[ AND "d_d" < DATE ']'||TO_CHAR(DATECUTOFFDATE,'YYYY-MM-DD')||q'[']'||
q'[ AND "k_c_d" < DATE ']'||TO_CHAR(DATECUTOFFDATE,'YYYY-MM-DD')||q'[')]'||
q'[ OR (( "a_" = 4 OR "a_" = 7 )]'||
q'[ AND ( "d_t" <> '3' OR "k_c_s" = 'Y' OR "r_t" = '0' OR "r_t" = '2' OR "r_t" = '3' )]'||
q'[ AND "d_d" < DATE ']'||TO_CHAR(DATECUTOFFDATE,'YYYY-MM-DD')||q'[']'||
q'[ AND "k_c_d" < DATE ']'||TO_CHAR(DATECUTOFFDATE,'YYYY-MM-DD')||q'[']'||
q'[ AND "r_d" < DATE ']'||TO_CHAR(DATECUTOFFDATE,'YYYY-MM-DD')||q'[']'||
q'[ AND "s_d" < DATE ']'||TO_CHAR(DATECUTOFFDATE,'YYYY-MM-DD')||q'[')]';
TESTSTRING := 'CREATE TABLE '||UCASEXTABLENAMETEMP||' AS SELECT * FROM '||UCASEXTABLENAME||'@'||XLINKNAME;
DBMS_OUTPUT.PUT_LINE(TESTSTRING);
DBMS_OUTPUT.PUT_LINE(TESTWHERE);
EXECUTE IMMEDIATE TESTSTRING||' '||TESTWHERE; -
Select count(*) on sql statement returning zero when a matching row exists.
Our account has an ANSI C application that checks for the existence a row on an Oracle table(s) by using the following SQL:
int iCount = 0;
EXEC SQL
SELECT count(rownum) INTO :iCount
FROM sys.all_tab_columns
WHERE table_name IN
(SELECT table_name FROM
sys.all_synonyms
WHERE upper(synonym_name) = upper(:szDestTable))
AND upper(column_name) = upper(:szColumnName)
AND owner = 'DBAUSER';
The bind variables szDestTable and szColumnName are populated with values parsed from columns on another database table. This application is executed through out the day. Occasionally, the application will report a zero in the iCount when there should be a match. I have verified the szDestTable and szColumnName are populated with the correct values which would find a match and they are correct. To make matters even stranger, the application will parse the same input values and find a match (as it should). At some point during the day, and it can be at any time, the application will NOT find a match on the same file, same values. Every subsequent execution of this application will not find a match on the same values. Once the database is brought down and started up in the evening for its normal backups, the application will find a match again on the same values. This problem does not occur every day. I could be a week or a week and a half between incidents.
I printed the contents of the sqlca.sqqlerrm.sqlerrmc field to a log file. The sqlca.sqlerrm.sqlerrmc field reported an ORA-1405 bind variable was null when the iCount was reporting a zero. When I compiled this application, I set the Proc*C flag to UNSAFE_NULLS=yes since there are other bind variable in the application that can be NULL and that is ok.
The above SQL is compiled into the C application using the Proc*C compiler. It is compiled using the Oracle 11.2.0.2 libraries. The application is executed against an Oracle 11.2.0.2 database. The database and application are executed on an HP/Unix 11.31 platform.
This problem did not start occurring until our account went from Oracle 10.2 to Oracle 11.2. Recently, I have changed the SQL to perform a “SELECT COUNT(rownum)” instead of the “SELECT COUNT(*)”. I compiled the application and executed the new application with the SELECT COUNT(rownum) against the same database where the same application with the SELECT COUNT(*) was failing to find a row that actually existed. The application with the SELECT COUNT(rownum) found the matching row as it should have. The new application has been executing in production for about 10 days now without any problems against ten various Oracle 11.2 databases.
Why would SELECT COUNT(*) and SELECT COUNT(rownum) be any different?This forum is about C programming in general, and about using Studio C in particular.
Your question is about Oracle database programming. You are more likely to find a helpful answer in a forum about database programming. Start here:
https://forums.oracle.com/forums/category.jspa?categoryID=18 -
Select count(*) and blank element tags
Is there a way other than column aliases to produce and return an element tag for the following xsql query.
<xsql:query
connection="{@cxn}"
xmlns:xsql="urn:oracle-xsql">
select count(*) from emp
</xsql:query>
Some databases such as SQL Server via a JDBC driver will return a blank column name, thus you'll have an invalid XML document, however SQL Server allows one to use column aliases, such as select count(*) as "count" from emp.
However some databases such as Progress via a JDBC-ODBC bridge and ODBC driver does NOT allow column aliases. Thus I'll always get the following response:
<ERROR>oracle.xml.sql.OracleXMLSQLException: String index out of range: </ERROR>
Question. Can I substitute an element tag when I encounter a blank column name using an action handler? Any ideas? Sample code?
Steve.Please have the data structure as below:
<datastructure>
<GROUP name="G_1" source="Q_TEMP">
<element value="DEPTNO" name="DEPTNO" />
<element value="DNAME" name="DNAME" />
<element value="LOC" name="LOC" />
<GROUP name="G_2" source="Q_TEMP1">
<element value="ENAME" name="ENAME" />
<element value="SAL" name="SAL" />
*</GROUP>*
*<element value="G_2.ENAME" name="TOTL_DETAILS" dataType="number" function="COUNT()" />*
*<element value="G_2.SAL" name="TOTL_SAL" function="SUM()"/>*
*</GROUP>*
</datastructure>
Aggregate functions to be placed at the level you require it. Here you need at G_1, so place it there. -
How do I execute "Select count(*) from table " in OCI
Hi,
I am new to OCI and so this question may seem stupid. I would like to know how to execute the query "select count(*) from <table>" using OCI V8 functionality? Also after how do I get the result into a integer datatype? I have gone through most of the demo programs but is is of little help to me.
Thanks in advance...
Regards,
Shubhayan.Hi,
Here is sample code to give you some idea how to do it. If you want some more info let me know.
Pankaj
ub4 count;
// Prepare the statement.
char szQry = "SELECT count() FROM T1";
if(OCI_ERROR == OCIStmtPrepare(pStmthp, pErrhp, (unsigned char*)szQry, strlen(szQry), OCI_NTV_SYNTAX , OCI_DEFAULT) )
cout << "Error in OCIStmtPrepare" << endl;
exit(1);
// Bind the output parameter.
OCIDefine *pDefnpp;
if(OCI_ERROR == OCIDefineByPos ( pStmthp, &pDefnpp, pErrhp, 1,
&count, sizeof(ub4), SQLT_INT,
(dvoid *) 0, (ub2 *) 0, (ub2 *) 0,
OCI_DEFAULT) )
cout << "Error in OCIDefineByPos" << endl;
exit(1);
if(OCI_ERROR == OCIStmtExecute(pSvchp, pStmthp, pErrhp, 1, 0, NULL, NULL, OCI_DEFAULT) )
cout << "Error in OCIStmtExecute" << endl;
exit(1); -
Get the select count(*)including Zero '0'
Hi Gurus,
I gotta problem here, I have this query:
SELECT COUNT(t.column1) AS mycount,
TO_CHAR(t.creation_date,'MONTH') AS themonth
FROM table1 t
WHERE t.creation_date BETWEEN TO_DATE('01/01/2011') AND TO_DATE('09/07/2011') AND t.column1 > 0
GROUP BY TO_CHAR(t.creation_date,'MONTH')
ORDER BY TO_DATE(TO_CHAR(t.creation_date,'MONTH'),'MONTH')
then I get this result from query
MYCOUNT | THEMONTH
JANUARY | 3
MARCH | 6
APRIL | 5
MAY | 9
JULY | 2
and what I need its kind of this
MYCOUNT | THEMONTH
JANUARY | 3
FEBRAURY | 0
MARCH | 6
APRIL | 5
MAY | 9
JUNE | 0
JULY | 2
what I'm doing wrong ? or what can I add to the code? please I hope you can help with this one.
Best Regards,
Mentormentor wrote:
Hey and when I dont have a range of dates, and only have many id's how can I get the result ?
SELECT NVL(COUNT(column1),0) mycount,
TO_CHAR(TRUNC(creation_date,'MM'),'MONTH') themonth
FROM (
SELECT column1,
creation_date
FROM table1
WHERE column_id IN (2,3,12,67,49,182)
AND column1 > 0
UNION ALL
SELECT NULL column1,
ADD_MONTHS(min_creation_date,LEVEL - 1) creation_date
FROM (
SELECT TRUNC(MIN(creation_date),'MM') min_creation_date,
TRUNC(MAX(creation_date),'MM') max_creation_date
FROM table1
WHERE column_id IN (2,3,12,67,49,182)
AND column1 > 0
CONNECT BY ADD_MONTHS(min_creation_date,LEVEL - 1) <= LAST_DAY(max_creation_date)
GROUP BY TRUNC(creation_date,'MM')
ORDER BY TRUNC(creation_date,'MM')
/ >
and another question, how can I get two counts of the same column where the condition its diferent ?
SELECT NVL(COUNT(CASE column2 WHEN 'JOHN' THEN 1 END),0) count_a,
NVL(COUNT(CASE column2 WHEN 'MICHAEL' THEN 1 END),0) count_b,
TO_CHAR(TRUNC(creation_date,'MM'),'MONTH') themonth
FROM (
SELECT column2,
creation_date
FROM table1
WHERE column2 IN ('JOHN','MICHAEL')
UNION ALL
SELECT NULL column2,
ADD_MONTHS(min_creation_date,LEVEL - 1) creation_date
FROM (
SELECT TRUNC(MIN(creation_date),'MM') min_creation_date,
TRUNC(MAX(creation_date),'MM') max_creation_date
FROM table1
WHERE column2 IN ('JOHN','MICHAEL')
CONNECT BY ADD_MONTHS(min_creation_date,LEVEL - 1) <= LAST_DAY(max_creation_date)
GROUP BY TRUNC(creation_date,'MM')
ORDER BY TRUNC(creation_date,'MM')
/ SY. -
How to do a 'select count' without a cursor
I am trying to do a select which will return exactly one row, such as:
select count(*) from orders;
Since there is inherent overhead in using a cursor, I am trying to find a way to do this without
generating a result set (both executeQuery and execute use result sets to return the data).
What I am looking for is something equivalent to ESQL:
select count(*) from orders INTO integervariable;
Does anyone know how to do this?The reason for the concern is because I am issuing the
SQL many times (thousands), with a slightly different
'where' clause each time, and the platform I am using
doesn't support 'prepare's.
So, even ignoring the overhead question, is there a
way to do this without using a result set, which
has an inherent cursor.No - there is no way of doing this without using a resultset. -
Performance issue when using select count on large tables
Hello Experts,
I have a requirement where i need to get count of data from a database table.Later on i need to display the count in ALV format.
As per my requirement, I have to use this select count inside a nested loops.
Below is the count snippet:
LOOP at systems assigning <fs_sc_systems>.
LOOP at date assigning <fs_sc_date>.
SELECT COUNT( DISTINCT crmd_orderadm_i~header )
FROM crmd_orderadm_i
INNER JOIN bbp_pdigp
ON crmd_orderadm_iclient EQ bbp_pdigpclient "MANDT is referred as client
AND crmd_orderadm_iguid EQ bbp_pdigpguid
INTO w_sc_count
WHERE crmd_orderadm_i~created_at BETWEEN <fs_sc_date>-start_timestamp
AND <fs_sc_date>-end_timestamp
AND bbp_pdigp~zz_scsys EQ <fs_sc_systems>-sys_name.
endloop.
endloop.
In the above code snippet,
<fs_sc_systems>-sys_name is having the system name,
<fs_sc_date>-start_timestamp is having the start date of month
and <fs_sc_date>-end_timestamp is the end date of month.
Also the data in tables crmd_orderadm_i and bbp_pdigp is very large and it increases every day.
Now,the above select query is taking a lot of time to give the count due to which i am facing performance issues.
Can any one pls help me out to optimize this code.
Thanks,
SumanHi Choudhary Suman ,
Try this:
SELECT crmd_orderadm_i~header
INTO it_header " interna table
FROM crmd_orderadm_i
INNER JOIN bbp_pdigp
ON crmd_orderadm_iclient EQ bbp_pdigpclient
AND crmd_orderadm_iguid EQ bbp_pdigpguid
FOR ALL ENTRIES IN date
WHERE crmd_orderadm_i~created_at BETWEEN date-start_timestamp
AND date-end_timestamp
AND bbp_pdigp~zz_scsys EQ date-sys_name.
SORT it_header BY header.
DELETE ADJACENT DUPLICATES FROM it_header
COMPARING header.
describe table it_header lines v_lines.
Hope this information is help to you.
Regards,
José -
Select count from large fact tables with bitmap indexes on them
Hi..
I have several large fact tables with bitmap indexes on them, and when I do a select count from these tables, I get a different result than when I do a select count, column one from the table, group by column one. I don't have any null values in these columns. Is there a patch or a one-off that can rectify this.
ThxYou may have corruption in the index if the queries ...
Select /*+ full(t) */ count(*) from my_table t
... and ...
Select /*+ index_combine(t my_index) */ count(*) from my_table t;
... give different results.
Look at metalink for patches, and in the meantime drop-and-recreate the indexes or make them unusable then rebuild them. -
Select count(*) statement in ABAP
Hi,
Im writing following statement in my Function module,
select count(*) into l_count
from user_master
where username = l_username and
process_type = processtype and
password = oldpassword.
And there is one entry in table user_master.
But still, I'm getting l_count as zero..
Can somebody help me with this.
Regards,
Ameyselect count(*) into l_count
from user_master
where username = l_username and
process_type = processtype and
password = oldpassword.
Use group by option...
Like this....
select count(*) into l_count
from user_master
where username = l_username and
process_type = processtype and
password = oldpassword group by username. -
Select Count(*) from Sample_table - how to get the count using JDBC?
Hi All,
It would be glad if anyone could help me with this. The problem is that I have to get the 'count' of records selected from a arbitrary table say, 'sample_table'. Is that possible to form the SQL in JDBC as
Select Count(*) from Sample_table
and get the value of the count? If yes, how?
Thanks in advance
Prabzstmt = con.createStatement();
ResultSet recordcnt_rs = stmt.executeQuery("Select Count (*) as record_ctr From Sample_table");
recordcnt_rs.next();
record_ctr = recordcnt_rs.getInt("record_ctr");
hope this helps. -
Select count(*) for each row of a table
Hello All,
Following query gives a statistics for each user (how many items he owns, home many tickets authored, how many objects he is subscribed to etc...)
select auser.userid,
(select count(*) from item where owner like '%' || auser.id || '%') ITEM_OWNER_CNT,
(select count(*) from tkt where originator = auser.id) TKT_ORIGINATE_CNT,
(select count(*) from tkt where assigned_to = auser.id) TKT_QA_CNT,
(select count(*) from tkt where create_user = auser.id) TKT_AUTHOR_CNT,
(select count(*) from subscriptions where subscriber_id = auser.id) SUBSCRIPTION_CNT
from
user auser
I was not happy with the performance of this query, so I tried the same using group by. The performance was even worse.
Is there any other option for me to try? Please advice.
Thanks,
SathishHi, Sathish,
As SBH said, a lot depends on your data. Please post some sample data (CREATE TABLE adn INSERT statemetns) for all tables, and the results you want from that data. Describe and give examples of any relationships that are not one-to-one..
You probably want to do joings, like SBH suggested, rather than scalar sub-queries.
The connection between the auser and item tables
(select count(*) from item where owner like '%' || auser.id || '%') ITEM_OWNER_CNT,is very suspicious. Perhaps the item table is poorly designed, and the query would be faster if that table were changed. Is changing the design of the item table an option?
You should be able to get all the information from the tkt table in one pass. It looks like you need to unpivot the data, so instead of one row per ticket (with 3 different people connected to it), there are 3 rows per ticket, each with only 1 person referenced. This is not necessarily a bad table design. Unpivoting, even more than most other things, depends on your database version, so you'll have to tell what version of Oracle you're using. -
Why is the select Count too slow
I am doing the following select count and calling it from my JSP to get the total number of records... why is it so slow...
select count(*)
from
(select distinct o.receive_id, o.name, o.address
from order o, item i
where o.id = i.id
and o.status = 2 and i.status = 0)If the data in the table that you are referring to in the query gets refreshed very often and your high water mark on your table not reset, then this query always runs longer. While deleting data in the table, use 'TRUNCATE' rather than 'DELETE' in your data queries. that would help reset the high water mark and your count() queries will run very very fast.
Maybe you are looking for
-
Cannot Delete CPTL file from Desktop using Vista
Hi All, I cannot Delete CPTL file from Desktop using Vista. Explorer crashes. It is a Captivate 2 file. I have tried (with no luck): - logging in as a different user and deleting the file. - running explorer as an Administrator - uninstalling Captiva
-
Problem with synchronize in web form
I'm runing forms server 6i with patchset 11... I'have a java bean wich extends VTextField, wich opens a file dialog and returns the path+filename selected... I have a navigable text item whose implementation class is this one for file dialog... Java
-
Safari doesn't even open..
when i open safari and go to open a url on safari boswer, all the options are grayed out... what does that mean?
-
Hi, we have a report that we use to print multiple result on multiple Y-AXIS. The problem is that in the legend, we only see the name of the channel, but not the name of the Y-AXIS that is associated with it. Is there a way we can print in the legend
-
I started this new site with weebly drag and drop. But I then found that all the development has to be done on that site and published using that tool. I want to be able to mix what is developed using this, or other good design tool, with my own code