# Process of optimizing catalog - what exactly is done?



## thommy (Mar 12, 2015)

Hi

I takes a very long time to run the optimize catalog that's following the backup of LR catalog. Almost 20 minutes..
What exactly is happening during this progress?
I have read that caches are cleared. Does that mean that if I have a large cache(8 GB in my case) it takes longer time for optimization?
And what else is done during optimization - just curious 

Thanks!

Thommy


----------



## clee01l (Mar 12, 2015)

I don't think that anything other than the catalog file is touched when Optimization occurs.

Still a lot gets done during optimization.  The catalog is a single file and in that file is a database consisting of several tables of record data.  During the course of norman operations records are deleted from various tables.  When a record is deleted the row is marked as such but the space is not released.  Part of the Optimization process is to collapse that no longer used space to make the file smaller. A smaller file processes faster.  The database is relational. That is records in one table are related to records in other tables.  The integrity of these relationships needs to be checked and if missing corrected.  There are special tables called indexes.  These speed up the database fetch process.  The last thing that might happen in the optimization process is that these indexes get completely rebuilt by the database engine.  There are a lot of individual steps to be performed during optimization. By their nature they need to be done serially.   in the process of doing this, temporary files are created. When complete your existing catalog file is overwritten with an optimized copy of the data base.


----------



## thommy (Mar 13, 2015)

Thanks for great help and explanation!

Best regards
Thommy


----------



## wtlloyd (Mar 13, 2015)

You may want to take a look at your hard drive health...do you have plenty of available space and do you defrag regularly?


----------



## clee01l (Mar 13, 2015)

wtlloyd said:


> You may want to take a look at your hard drive health...do you have plenty of available space and do you defrag regularly?


Modern operating systems (Win7 and later) do not require a manual defragmentation process for HDDs (Spinning discs).  Windows now handles this in the background on a schedule automatically. And for SSDs, it is irrelevant.


----------



## Modesto Vega (Mar 14, 2015)

Typically I optimise the catalog when I shut down Lr at the end of the day and try to do this every day. I leave the computer doing its work and do something else, I don't wait for the process to finish. If I need to shutdown Lr during the day, I have it configured to allow me to skip backing up and optimising the catalog.

There are 2 reasons for this set up:

a)  I can get very lazy and forget that I need to this, the longer I leave it the longer it takes. Having Lr configured this way acts as a reminder

b) The whole process takes time, certainly much more than 5 minutes, even if I do it regularly, this way I can just leave the computer working while I do someting else

The Lr catalogue is a database and one of the things the optimisation does is cleaning up and optimising the database (Cletus explains it very well). The bigger the database is the longer it takes, the more changes you have done since the last optimisation the longer it gets.


----------



## wtlloyd (Mar 14, 2015)

clee01l said:


> Modern operating systems (Win7 and later) do not require a manual defragmentation process for HDDs (Spinning discs).  Windows now handles this in the background on a schedule automatically. And for SSDs, it is irrelevant.



Yes, I know, but you have the option to set that operation to manual. And that is how mine is set. There was no indication whether he has an SSD. And of course, sometimes people aren't aware of how full their drive is and the OS may be frantically compacting files on the fly for a little operational space. 
My first hard drive was 40 megabytes,  so I've always kept an eye out for drive management.


----------

