Issue Details (XML | Word | Printable)

Key: CORE-2165
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Vlad Khorsun
Reporter: Kuznetsov Eugene
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Unnecessary 1 index read may occur when using strict inequality condition

Created: 04/Nov/08 02:11 PM   Updated: 19/Jan/16 04:57 AM
Component/s: Engine
Affects Version/s: 2.0.1, 2.0.3, 2.1.0, 2.0.4, 2.5 Alpha 1, 2.1.1
Fix Version/s: 3.0 Alpha 2, 2.1.6, 2.5.3

Issue Links:
Relate
 

QA Status: No test


 Description  « Hide
Run isql-script (for 3-d dialect, for example)

SET SQL DIALECT 3;
SET NAMES NONE;
CREATE DATABASE 'localhost:test_index3d'
USER 'SYSDBA' PASSWORD 'masterkey'
PAGE_SIZE 4096
DEFAULT CHARACTER SET NONE;

COMMIT;

CREATE TABLE MASTER1
(ID INTEGER NOT NULL);

CREATE TABLE MASTER2
(ID INTEGER NOT NULL);

ALTER TABLE MASTER1
ADD CONSTRAINT PK_MASTER1 PRIMARY KEY(ID);

ALTER TABLE MASTER2
ADD CONSTRAINT PK_MASTER2 PRIMARY KEY(ID);


COMMIT;

INSERT INTO MASTER1 VALUES (1);
INSERT INTO MASTER1 VALUES (2);
INSERT INTO MASTER1 VALUES (3);

SET TERM ^ ;

EXECUTE BLOCK
AS
DECLARE VARIABLE I INTEGER;
BEGIN
  I = 0;
  WHILE (I < 100000) DO BEGIN
    I = I +1;
    INSERT INTO MASTER2
    VALUES
    (:I);
  END
END^

SET TERM ; ^

COMMIT;

SET STATISTICS INDEX PK_MASTER1;
SET STATISTICS INDEX PK_MASTER2;

COMMIT;

Now,

select * from master1
where id > 3

requires 1 index read from master1 (it shouldn't)

and

select Count(*) from master2
where id > 99000

requires 1001 index reads from master2 (should be 1000).

It seems, it's "floating" error, as

select * from master1
where id > 2

requires 1 index read - that is correct.

--
Best regards, Eugene

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.