Answer the question
In order to leave comments, you need to log in
How to solve Yii2 Active Record slow meta query issue?
Good afternoon,
Please tell me how to solve the problem. There is a SQL Server database for CRM on it, when working with this database, queries last indecently long (on other databases it works quickly). The built-in debugger shows that a query that receives FK keys and column names takes 4 seconds, this is only for one table. Running this query through Management Studio, the execution time is the same. Is it possible in Yii2 to disable validation of this particular key association? Or how to get out of this situation?
The request itself.
SELECT
[rc].[constraint_name] AS [fk_name],
[kcu1].[column_name] AS [fk_column_name],
[kcu2].[table_name] AS [uq_table_name],
[kcu2].[column_name] AS [uq_column_name]
FROM [ INFORMATION_SCHEMA].[REFERENTIAL_CONSTRAINTS] AS [rc]
JOIN [INFORMATION_SCHEMA].[KEY_COLUMN_USAGE] AS [kcu1] ON
[kcu1].[constraint_catalog] = [rc].[constraint_catalog] AND
[kcu1].[constraint_schema] = [rc].[constraint_schema] AND
[kcu1].[ constraint_name] = [rc].[constraint_name]
JOIN [INFORMATION_SCHEMA].[KEY_COLUMN_USAGE] AS [kcu2] ON
[kcu2].[constraint_catalog] = [rc].[constraint_catalog] AND
[kcu2].[constraint_schema] = [rc] .[constraint_schema] AND
[kcu2].[constraint_name] = [rc].[unique_constraint_name] AND
[kcu2].[ordinal_position] = [kcu1].[ordinal_position]
WHERE [kcu1].[table_name] = 'Account' AND [ kcu1].[table_schema] = 'dbo'
Answer the question
In order to leave comments, you need to log in
In the database config
, you can also set the time
. Usually they put it on the sale. All meta requests will be cached
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question