Excessive disk space consumption on BLOB concatenation
------------------------------------------------------

                 Key: CORE-3948
                 URL: http://tracker.firebirdsql.org/browse/CORE-3948
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 2.5.1
         Environment: Windows 7 Professional 64bit
            Reporter: Jörg Fröber


When a blob is being concatenated mulitple times, the disk space for the 
database file grows massively. The only way to get the file size back to normal 
is a backup and restore of the database.

The issue can be reproduced as described below: 

- Create an empty database
-  Create the following procedure:

SET TERM ^ ;

CREATE OR ALTER PROCEDURE P_TEST (
  TEST VARCHAR(200),
  ITERATIONS INTEGER)
RETURNS (
  BLOBTEXT BLOB SUB_TYPE 0 SEGMENT SIZE 80)
AS
DECLARE COUNTER INTEGER;
BEGIN
  COUNTER = 0;
  BLOBTEXT = '';

  WHILE (COUNTER < ITERATIONS)
  DO
  BEGIN
    BLOBTEXT = BLOBTEXT || ' ' || TEST;
    COUNTER = COUNTER + 1;
  END 

  SUSPEND;
END^

SET TERM ; ^

GRANT EXECUTE ON PROCEDURE P_TEST TO "PUBLIC";
GRANT EXECUTE ON PROCEDURE P_TEST TO SYSDBA;

- run the procedure:

SELECT BLOBTEXT FROM P_TEST('This is a test sentence, which is going to be 
concatenated.', 4000);


After the procedure has been executed, the disk space used by the database file 
increases to over 1 GB. It makes no difference, if the transaction is committed 
or not.
When you run the procedure another time using the SQL-command EXECUTE PROCEDURE 
P_TEST('This is a test sentence, which is going to be concatenated.', 4000); 
the file size increases again.

-- 
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

       

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to