Version 5 supported

ORM performance


You can define indexes for your ORM queries using the $indexes configuration property in your DataObject subclasses. See the Indexes section for more information.

TreeDropdownField SearchFilter configuration

The TreeDropdownField uses a PartialMatchFilter by default to match against records. Indexes aren't effective when this filter is used, so you may find this field is slow with large datasets.

You can configure the field to use a different filter (such as StartsWithFilter) using the TreeDropdownField.search_filter configuration property:

  search_filter: 'StartsWith'

A very common use of TreeDropdownField is the "Insert Link" feature in the TinyMCE WYSIWYG. Setting this configuration to use another filter and adding an index on Title and MenuTitle for SiteTree can significantly improve performance.

See SearchFilter Modifiers for more information about search filters.

Skipping check and repair during dev/build

When you run dev/build, there is a step that checks the integrity of the database tables (via CHECK TABLE) and repairs issues (via REPAIR TABLE) if possible.

For tables with many records (tens/hundreds of thousands) this can be slow. If you identify that you have some specific DataObject models with lots of records which are slowing down your dev/build, you might want to explicitly skip checks for those:

    - App\Model\ModelWithManyRecords

Note: The entire inheritance chain (both ancestors and descendents) of models in that configuration array will be excluded from the check and repair step.

You can also disable these checks entirely:

  check_and_repair_on_build: false

You can always manually trigger a check and repair (e.g. in a BuildTask) by calling DB::check_and_repair_table(). This ignores the above configuration.