Re: new database files not compressed

Hamish Moffatt
2020-08-31T02:44:27Z

On 31/8/20 12:20 pm, Eric Wong wrote:
> Hamish Moffatt <hamish-btrfs@moffatt.email> wrote:
>> I am trying to store Firebird database files compressed on btrfs. Although I
>> have mounted the file system with -o compress-force, new files created by
>> Firebird are not being compressed according to compsize. If I copy them, or
>> use btrfs filesystem defrag, they compress well.
>>
>> Other files seem to be compressed automatically OK. Why are the Firebird
>> files different?
> Maybe Firebird creates DB with the No_COW attribute?
> "lsattr -l /path/to/file" to check.
>
> I don't know much about Firebird; but No_COW is pretty much
> required for big database, VM images, etc which are subject to
> random writes. Unfortunately, neither compression nor
> checksumming are available with No_COW set.
>
> Big SQLite and Xapian DBs gave me trouble even on an SSD before
> I recreated them with No_COW. Small DBs can probably get away
> with autodefrag.

I don't see anything in the lsattr output;

$ isql-fb
Use CONNECT or CREATE DATABASE to specify a database
SQL> create database 'foo.fdb';
SQL> ^D

$ lsattr foo.fdb
------------------- foo.fdb
$ lsattr -l foo.fdb
foo.fdb                      ---
$ sudo compsize foo.fdb
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL      100%      768K         768K         768K
none       100%      768K         768K         768K

Still, if you're telling me that trying to use compression on database
files is a bad idea, thanks for the warning and I'll let it be.

Hamish