473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Inconsistent Query Results

Hello all,

I've got what appears to be a bug in Oracle, but I don't want to make
that judgement until I get someone's opinion who knows Oracle better
than I.

I'm running Oracle 8i on Solaris 7. I have a query that I get
different result sets with and without a specific index. This is
repeatable with these tables, though I haven't been able to isolate
anything other than the index. I have the following output from a set
of operations that shows the problem. As you can see, without the
index, I get a set of records for a specific query, but when I add the
index and do an analzye on the the table, I get no results from the
same query.

I didn't include any results from an explain plan, because it was
huge, if anyone wants to see it, please let me know.

Any feedback on this would be greatly appreciated,

Adam Ruth

drop index tcomputer_os_name

Index dropped

analyze table tcomputer compute statistics

Table analyzed

select * from ttcno_compliance tc where exists (select * from
tcomputer where computer_sys_id = tc.computer_sys_id and os_name =
'SunOS')

TCNO_ENTRY_ID COMPUTER_SYS_ID STATUS
------------- ---------------------------------------- ------
1 2159101373 X
61 2159101373 X
101 2159101373 X
121 2159101373 X
201 2159101373 X
1 2159101490 X
61 2159101490 X
101 2159101490 X
121 2159101490 X
201 2159101490 X
1 2164192390 X
61 2164192390 X
101 2164192390 X
121 2164192390 X
201 2164192390 X
1 2199466309 X
61 2199466309 X
101 2199466309 X
121 2199466309 X
201 2199466309 X
1 2198383241 X
61 2198383241 X
62 2198383241 P
81 2198383241 P
101 2198383241 X
121 2198383241 X
162 2198383241 P
201 2198383241 X
230 2198383241 X
230 2199466309 X
230 2159101490 X
230 2159101373 X
230 2164192390 X
33 rows selected

create index tcomputer_os_name on tcomputer(os_name)

Index created

analyze table tcomputer compute statistics

Table analyzed

select * from ttcno_compliance tc where exists (select * from
tcomputer where computer_sys_id = tc.computer_sys_id and os_name =
'SunOS')

TCNO_ENTRY_ID COMPUTER_SYS_ID STATUS
------------- ---------------------------------------- ------
0 rows selected
Jul 19 '05 #1
8 6074

Did you check that OS_NAME is not NULL???

NULLs in any OS_NAME will produce invalid results in your query.

--
Posted via http://dbforums.com
Jul 19 '05 #2
LKBrwn_DBA <me*********@dbforums.com> wrote in message news:<30****************@dbforums.com>...
Did you check that OS_NAME is not NULL???

NULLs in any OS_NAME will produce invalid results in your query.


Where did u learn that utter nonsense?
He isn't including NULLs in his query is he?
The records with NULL os_names will be excluded, and also he isn't
asking for them, so nothing wrong.

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #3
LKBrwn_DBA <me*********@dbforums.com> wrote in message news:<30****************@dbforums.com>...
Did you check that OS_NAME is not NULL???

NULLs in any OS_NAME will produce invalid results in your query.


There are no nulls in the os_name column. Even so, I disagree with
your assertion. Just because row x has a null value doesn't change
the fact that row y exists. select ... where os_name = 'SunOS' should
always return the same 5 records (in my table) no matter how many
other records have a null os_name.

In any event, nulls or not, an index shouldn't change the query
results, should it?

Adam Ruth
Jul 19 '05 #4

True about the nulls.

I could not re-produce your error:

SQL>drop index tcomputer_os_name
2 /

Index dropped.

SQL>select * from ttcno_compliance tc
2 where exists (
3 select * from tcomputer
4 where computer_sys_id = tc.computer_sys_id
5 and os_name = 'SunOS')
6 /

TCNO_ENTRY_ID COMPUTER_SYS S
------------- ------------ -
1 2159101373 X
61 2159101373 X
101 2159101373 X
121 2159101373 X
201 2159101373 X
1 2159101490 X
61 2159101490 X
101 2159101490 X
121 2159101490 X
201 2159101490 X
230 2159101490 X
230 2159101373 X

12 rows selected.

SQL>create index tcomputer_os_name on tcomputer(os_name)
2 /

Index created.

SQL>analyze table tcomputer compute statistics
2 /

Table analyzed.

SQL>select * from ttcno_compliance tc
2 where exists (
3 select * from tcomputer
4 where computer_sys_id = tc.computer_sys_id
5 and os_name = 'SunOS')
6 /

TCNO_ENTRY_ID COMPUTER_SYS S
------------- ------------ -
1 2159101373 X
61 2159101373 X
101 2159101373 X
121 2159101373 X
201 2159101373 X
1 2159101490 X
61 2159101490 X
101 2159101490 X
121 2159101490 X
201 2159101490 X
230 2159101490 X
230 2159101373 X

12 rows selected.

SQL>

--
Posted via http://dbforums.com
Jul 19 '05 #5
hello,

what patchlevel does your db have ?

I remember there was a optimizer bug in Versions < 8.1.7.3
(somthing with <and> <or> combinations, so not your exacly
your query), but who knows.

regards

s.kapitza
ow***@hotmail.com (Adam Ruth) wrote in message news:<f0**************************@posting.google. com>...
Hello all,

I've got what appears to be a bug in Oracle, but I don't want to make
that judgement until I get someone's opinion who knows Oracle better
than I.

I'm running Oracle 8i on Solaris 7. I have a query that I get
different result sets with and without a specific index. This is
repeatable with these tables, though I haven't been able to isolate
anything other than the index. I have the following output from a set
of operations that shows the problem. As you can see, without the
index, I get a set of records for a specific query, but when I add the
index and do an analzye on the the table, I get no results from the
same query.

I didn't include any results from an explain plan, because it was
huge, if anyone wants to see it, please let me know.

Any feedback on this would be greatly appreciated,

Adam Ruth

drop index tcomputer_os_name

Index dropped

analyze table tcomputer compute statistics

Table analyzed

select * from ttcno_compliance tc where exists (select * from
tcomputer where computer_sys_id = tc.computer_sys_id and os_name =
'SunOS')

TCNO_ENTRY_ID COMPUTER_SYS_ID STATUS
------------- ---------------------------------------- ------
1 2159101373 X
61 2159101373 X
101 2159101373 X
121 2159101373 X
201 2159101373 X
1 2159101490 X
61 2159101490 X
101 2159101490 X
121 2159101490 X
201 2159101490 X
1 2164192390 X
61 2164192390 X
101 2164192390 X
121 2164192390 X
201 2164192390 X
1 2199466309 X
61 2199466309 X
101 2199466309 X
121 2199466309 X
201 2199466309 X
1 2198383241 X
61 2198383241 X
62 2198383241 P
81 2198383241 P
101 2198383241 X
121 2198383241 X
162 2198383241 P
201 2198383241 X
230 2198383241 X
230 2199466309 X
230 2159101490 X
230 2159101373 X
230 2164192390 X
33 rows selected

create index tcomputer_os_name on tcomputer(os_name)

Index created

analyze table tcomputer compute statistics

Table analyzed

select * from ttcno_compliance tc where exists (select * from
tcomputer where computer_sys_id = tc.computer_sys_id and os_name =
'SunOS')

TCNO_ENTRY_ID COMPUTER_SYS_ID STATUS
------------- ---------------------------------------- ------
0 rows selected

Jul 19 '05 #6
sk******@volcanomail.com (s.kapitza) wrote in message news:<26**************************@posting.google. com>...
hello,

what patchlevel does your db have ?

I remember there was a optimizer bug in Versions < 8.1.7.3
(somthing with <and> <or> combinations, so not your exacly
your query), but who knows.

regards

s.kapitza
ow***@hotmail.com (Adam Ruth) wrote in message news:<f0**************************@posting.google. com>...
Hello all,

I've got what appears to be a bug in Oracle, but I don't want to make
that judgement until I get someone's opinion who knows Oracle better
than I.


Oops, I meant that most of the databases here are 8i, and this one is
9i. Typing too fast...
Jul 19 '05 #7

ABOUT NULLS
to: sybrandb

"When an indexed column is NULL, or when all columns in a
concatenated index are NULL, then the row concerned will NOT have an
entry in the index"

Quote from:
Oracle SQL High-Performance Tuning
Second Edition
Page 120, paragraph 8 "NULL VALUES"
Author:Guy Harrison
(c) 2001 - Prentice Hall PTR

--
Posted via http://dbforums.com
Jul 19 '05 #8
LKBrwn_DBA <me*********@dbforums.com> wrote in message news:<30****************@dbforums.com>...
ABOUT NULLS
to: sybrandb

"When an indexed column is NULL, or when all columns in a
concatenated index are NULL, then the row concerned will NOT have an
entry in the index"

Quote from:
Oracle SQL High-Performance Tuning
Second Edition
Page 120, paragraph 8 "NULL VALUES"
Author:Guy Harrison
(c) 2001 - Prentice Hall PTR


That's true, but it's not going to affect a query that uses the index.
If a query is using the index, then it's only going to search for
rows that have a value, since to use the index there will need to be a
where clause on that column.

In the end, the presence of nulls in a column is NOT going to affect
the results that are returned, whether or not the column is indexed.

The statement "NULLs in any OS_NAME will produce invalid results in
your query." is inaccurate.

Adam Ruth
Jul 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ellen Manning | last post by:
I've got an A2K continuous form based on a query of 2 tables. The query returns results if the field "Outstanding" = Yes. The form's recordset type is set to Inconsistent Updates. If the user...
0
by: bjbounce2002 | last post by:
Hello, I have a field containing OLE Objects in Access 97. The OLE Objects are links to Microsoft Word templates. I have a parameter query which uses criteria Like "*" & & "*" to bring up...
5
by: chloe.crowder | last post by:
Hi I have an oddity. If I run a piece of SQL: SELECT EmployeeNo, MailTo FROM ST_PPS.dbo.Employee where AddedOn BETWEEN '01-jan-2006' and '01-feb-2006' AND MailTo NOT IN ( '3', 'x') order...
3
by: codeman | last post by:
Hi all Lets say we have two tables: Customer: Customer_number : Decimal(15) Name : Char(30) Purchase: Purchase_number : Decimal(15)
20
by: Francine.Neary | last post by:
I am learning C, having fun with strings & pointers at the moment! The following program is my solution to an exercise to take an input, strip the first word, and output the rest. It works fine...
1
by: catudalg | last post by:
Configuration: Windows 2000 sp3 MS Access 2000 (9.0.4402 SR-1) Visual Foxpro 9.0 detached tables MS VFP Driver 6.01.6830.01 06/19/2003 For example, a simple query like: select * from ddwg1...
7
by: bruce.dodds | last post by:
Access seems to be handling a date string conversion inconsistently in an append query. The query converts a YYYYMM string into a date, using the following function: CDate(Right(,2) & "/1/" &...
8
by: Adam Ruth | last post by:
Hello all, I've got what appears to be a bug in Oracle, but I don't want to make that judgement until I get someone's opinion who knows Oracle better than I. I'm running Oracle 8i on Solaris...
1
by: rnhuch | last post by:
My platform is SQL Server 2005. One of the tables of my db has 28589928 rows and one of the fields is real. When I backup and restore this database to another server (using the SQL Server internal...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.