Before SQL Server 2016 you needed the trace flag to enable query optimizer fixes from previous SQL Server versions.
Since SQL Server 2016 these fixes from previous versions are applied by default and TF 4199 will enable query optimizer fixes that are released in CUs and SPs (but since you are using SQL Server 2017, SPs aren't applicable to you).
Enabling the TF might enhance performance, but it might do the exact opposite for certain queries as well. Different behavior from the QO can result in different execution plans and thus different performance.
Since SQL Server 2016 you can enable the optimizer fixes on a database level by setting the
QUERY_OPTIMIZER_HOTFIXES database option.
For a specific query you can test the performance by using the query hint
ENABLE_QUERY_OPTIMIZER_HOTFIXES or by using
In general, don't expect a major difference by setting the TF on or off. Instead you should start by tuning your queries and indexes.