Home

Any way to disable or limit Linqpad "Fetching schema"

I have a query which uses 2 databases. One of the databases is quite large with many tables, sprocs, and views. When executing a saved query which uses the connection Linqpad goes into "Fetching schema..." mode and it takes a couple of minutes due to the large schema.

Is there any way to disable the schema update or whatever Linqpad is doing for select queries, or connections? Not sure if Linqpad can cache the schema, or something like that?

Comments

  • I still haven't found a solution to this. Maybe I should create an entity model in a separate assembly that contains a reduced number of tables/views/sprocs and then reference that assembly, although this is not ideal. When I have time, I may try this approach, unless someone has an alternative?
  • I've also been looking for the ability to cache the schema. Also long database loading times. There appears to have been such an option at some point, but I suspect it might have been removed.
  • edited November 2018
    The schema automatically caches, but LINQPad refreshes the cache if the schema has been updated since last time ("select max (modify_date) from sys.objects"). There's no way to force it to use the cache if the schema is stale.
  • Thank you for the information. We have an automated process that performs some alter statements at night. So once a day, the database is cached again, but after that it goes pretty fast.
  • @JoeAlbahari said:
    The schema automatically caches, but LINQPad refreshes the cache if the schema has been updated since last time ("select max (modify_date) from sys.objects"). There's no way to force it to use the cache if the schema is stale.

    Hi, @JoeAlbahari, I appreciate it's an old topic, but in our organization we just came across an issue where we run a lot of linqpad scripts on a schedule, and it creates a lot of DB overhead constantly retrieving the full schema (our DBA reported billions of logical reads over 24 hours caused by the schema retrieval query). We have inspected the sys.objects and found out there is a lot of ongoing modifications related to partitioning and full-text indexing, the objects are named like "ifts_comp_fragment_1044198770_2836519" or "fulltext_avdl_885578193". All these objects have IT (INTERNAL_TABLE) type, and there is no actual reason to invalidate the schema cache due to change in these objects .

    Is it possible to exclude INTERNAL_TABLE objects from the query you mentioned above? We are using LinqPad 5.

    Kind Regards
    Gleb

  • You've made a good point: the max(modify_date) query should include a predicate that includes only types relevant to the schema being mapped. This would have the added benefit of ignoring SP/function updates when the "Include Stored Procs and Functions" checkbox hasn't been selected.

    I've implemented a filter in the latest LINQPad 7 beta:
    https://www.linqpad.net/linqpad7.aspx#beta

    Let me know how you get on. If this doesn't cause any issues, I can backport this to LINQPad 5.

  • That's great, I tested and it seems it behaves as expected, however I cannot run the full test as all our scripts are under .NET Framework and we cannot port them quickly due to external dependencies. If you could add the change into LinqPad 5 Beta, it would be amazing.

    Just to make sure, the change applies to both LinqPad and LPRun, correct?

Sign In or Register to comment.