|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Database File Fragmentation
I'm having trouble with fragmentation of the database file.
I have a firebird database that grows to several gigabytes. I found out that it's heavily fragmented, more than 7000 fragments for a 5GB file, and performance suffers a lot from this. A partial solution I found was preallocating the file by setting the length to f.ex. 6 BG after database creation. The problem of course is that I don't know how much to allocate, and whenever the database file needs more space then the fragmenting behaviour returns. Is there any way to force FB to grow the file in larger increments? |
|
#2
|
||||
|
||||
|
Use a larger pagesize, but I don't think it's what you are looking for.
Do you know that a Firebird database can span more files? Simply build more than one datafile. On what OS are you on? File fragmentation is at filesystem level and not at database level, you'd get it with other DBMS also.
__________________
My blog Tutorials about OSS databases, DBMonster ... Contribute to OSS Development, fill bug reports! Developer Shed eSupport Commented my.ini/my.cnf (ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins Random data (with a bias) |
|
#3
|
|||
|
|||
|
Quote:
This is actually the opposite of what I want. Multiple files would be just as bad or worse than a big fragmented file - both cases force the disk to seek a lot, especially for sequential access. I do realize that file fragmentation is an OS issue, but if FB could be configured to grow a file in larger increments typically fewer fragments would be created by the OS. |
|
#4
|
|||
|
|||
|
Quote:
Not necessarily. If you distribute the files over several physical harddisks you can actually speed up the read time as the seeking can be done in parallel by each harddisk. Btw: how do you know that fragmentation is your problem? I'm quite curious how you can pinpoint fragmentation as the root cause of your problem. |
|
#5
|
|||
|
|||
|
Because after I defragmented the file (By copying to another file, deleting old file, renaming new file to old name) I got a serious performance increase.
(I also made sure that it wasn't just because a large part of the file was being cached by Windows because of the previous copy). |
|
#6
|
|||
|
|||
|
Quote:
![]() |
|
#7
|
||||
|
||||
|
I meant don't let it grow by itself, add yourself a new datafile of enough size.
After a check it seems that unlike oracle, in firebird you can't control growth parameters |
|
#8
|
|||
|
|||
|
Quote:
Well problem is: 1. I would have to know beforehand that the database needed to grow. 2. Unless I can put the new file on another physical disk then the end result is worse than a single fragmented file. |
|
#9
|
||||
|
||||
|
Quote:
Quote:
But I think that two non fragmented files are better than one fragmented |
|
#10
|
|||
|
|||
|
Quote:
To be able to make an estimate I would have to know how much of a given file the database is currently using. Is this possible? 1 file with 2 fragments is definitely better than 2 unfragmented files If I know/suspect that the file is going to grow then I might as well just grow it a couple of gigs myself.As for files on different disks - it's not really a solution as I don't have an unlimited supply of extra physical disks connected to the computer;p When creating a database and setting the file length to 6GB both DatabaseInfo.DatabaseSizeInPages and FBDatabaseInfo.AllocationPages return the same number: 6 GB / PageSize, not the amount of pages actually being used. PS: The above method names are from the :Net connector, it's using the isc_database_info() function on client dll. |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Database File Fragmentation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|