Switch to: V12V11V10V9V8V7V6V5

Automatic Optimization

Ability to do manual optimization for FK raise question: if we can do similar optimization for ObjectPtr and BinaryLink? Answer is YES, we can.

For this Valentina offers the VTable.MaxRecordCount property.

On default each Table has this property equal to ULONG_MAX. You can change it to a smaller value after CREATE TABLE command.

You can change this parameter even when there are records in tables, although in this case this operation may require some time, because it needs to change types of few columns and reindex them. So it is best of all if you specify this parameter during the database creation.

So what happens in background?

  • When Valentina sees that this parameter is smaller of ULONG_MAX it start to use for any RecID stored on disk not 4 bytes but less.
  • On default we say that RecID field has type ULONG type (4 bytes). Actually RecID field itself does not use any disk space. But each index of this table stores RecID of some indexed value. So indexes become smaller. Note that table can have N indexes.
  • If you make some ObjectPtr field that point that Table, then Valentina sees that it can use not 4 bytes but e.g. 2 bytes for this ObjectPtr. So we get smaller ObjectPtr and smaller its index.
  • The same works for BinaryLinks.

As you see by single parameter you can control a lots of things that are optimized automatically.


This property introduced in 2.4 b10. You can start using it in your code. But it will not have any effect yet. We still recommend to start using it to become familiar to it.