I have a select query to retrieve data from tables. It is working fine, but when there's a condition to select some 3 values, it is not giving a result. Error message;
Query processor ran out of Internal resources
I looked through INDEX seems to work fine, then I created view with that select statement, but couldn't create an index. Error message;
View is not schema bound
SCHEMABINDING. Binds the view to the schema of the underlying table or tables. When SCHEMABINDING is specified, the base table or tables cannot be modified in a way that would affect the view definition.
Schema binding refers to the process of associating a database view to underlying tables in order to put indexes directly on the view. This may lead to great performance benefits when using the view; however, this tighter coupling is not without drawbacks.
You Can't… The view is created with the WITH SCHEMABINDING option. You can't always predict what the query optimizer will do. If you're using Enterprise Edition, it will automatically consider the unique clustered index as an option for a query – but if it finds a “better” index, that will be used.
In order to create an indexed view the view needs to be schema bound to the entities that it is a view over.
To make a view schema bound, simply specify simply use WITH SCHEMABINDING
in the view CREATE
/ UPDATE
query, for example:
CREATE VIEW MyView
WITH SCHEMABINDING
AS
-- SELECT
See this link for more information on schema binding, or the MSDN page on the CREATE VIEW statement.
However from what you have said I don't think the indexed view will necessarily help you - the message "Query processor ran out of Internal resources" means that the query processor failed to produce an execution plan for your query, which I would guess only happens with extremely complex queries.
You should try to reduce the complexity of your query somehow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With