unexpected message 'unable to allocate memory from OS' when trying to get left( 
<blob>, 10) if  it's length between 8126433 and 8126433
---------------------------------------------------------------------------------------------------------------------------------------

                 Key: CORE-4065
                 URL: http://tracker.firebirdsql.org/browse/CORE-4065
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
            Reporter: Pavel Zotov


create database 'tb.fdb'; commit;
create sequence g;
commit;

create table c(id int, f char(31)); commit;

-- fill table `c` with IDs and character strings:
--=================================
insert into c select gen_id(g,1), f.rdb$field_name from rdb$fields 
f,rdb$fields,rdb$relations; commit;

set blob all;
set stat on;
select left(x, 10) from (select list(f) x from (select f from c where 
id<262144)) where x similar to '%$%';

             LEFT
=================
             0:5d
==============================================================================
LEFT:
RDB$VIEW_C
==============================================================================

Current memory = 348919064
Delta memory = 343949652
Max memory = 563184888
Elapsed time= 3.84 sec
Buffers = 1024
Reads = 13291
Writes 2332
Fetches = 1363855

SQL> select left(x, 10) from (select list(f) x from (select f from c where 
id<262145)) where x similar to '%$%';

             LEFT
=================
Statement failed, SQLSTATE = HY001
unable to allocate memory from operating system

-- NOTE: this message looks very strange because I have about 2 Gb RAM on 
machine and Firebird consumes only ~384 Mb at the peak of this operation. 

SQL> select sum(char_length(f)) from c where id<262144;

                  SUM
=====================
              8126433 -- this is the value where we yet *CAN* get result of 
list()

SQL> select sum(char_length(f)) from c where id<262145;

                  SUM
=====================
              8126464 -- this is the value where we can *NOT*  get result of 
list()

1) What is the `magic` in the length of the blob that is to be processed via 
SIMILAR TO ?
2) Why the trivial search of FIRST occurence of  single '$' character 
(moreover, it is just at the beginning of blob) is extremely slow (3.84 sec) ?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to