{"id":256,"date":"2023-09-11T07:42:41","date_gmt":"2023-09-11T07:42:41","guid":{"rendered":"http:\/\/77interactive.com\/?p=256"},"modified":"2023-09-25T22:28:59","modified_gmt":"2023-09-25T22:28:59","slug":"query-plans","status":"publish","type":"post","link":"http:\/\/77interactive.com\/?p=256","title":{"rendered":"Query Plans"},"content":{"rendered":"\n<p>Some Query Plan<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>use DBName;\ngo\n\n--  View the plan, along with a FreeProcCache command\n--  SQL Server 2008+ only\nselect  deqs.plan_handle\n      , deqs.sql_handle\n      , execText.text\n      , QP.query_plan\n      , 'DBCC FREEPROCCACHE (' + convert(varchar(1000), deqs.plan_handle, 1) + ');' as DropStatement\nfrom    sys.dm_exec_query_stats                            deqs\n        cross apply sys.dm_exec_sql_text(deqs.plan_handle) as execText\n        cross apply sys.dm_exec_query_plan(plan_handle) as QP\nwhere   execText.text like '%SEARCH_STRING%';\n\n--  Use Counts for plans\nselect  CP.usecounts\n      , CP.cacheobjtype\n      , CP.objtype\n      , ST.&#91;text]\nfrom    sys.dm_exec_cached_plans                      as CP\n        cross apply sys.dm_exec_sql_text(plan_handle) as ST\n        cross apply sys.dm_exec_query_plan(plan_handle) as QP\nwhere   ST.&#91;text] like '%SEARCH_STRING%';\n\nselect  D1.name\n      , QText.text                                                                                 as TSQL_Text\n      , cast(cast(QS.total_worker_time as decimal) \/ cast(QS.execution_count as decimal) as int)   as cpu_per_execution\n      , cast(cast(QS.total_logical_reads as decimal) \/ cast(QS.execution_count as decimal) as int) as logical_reads_per_execution\n      , cast(cast(QS.total_elapsed_time as decimal) \/ cast(QS.execution_count as decimal) as int)  as elapsed_time_per_execution\n      , QS.creation_time\n      , QS.execution_count\n      , QS.total_worker_time                                                                       as total_cpu_time\n      , QS.max_worker_time                                                                         as max_cpu_time\n      , QS.total_elapsed_time\n      , QS.max_elapsed_time\n      , QS.total_logical_reads\n      , QS.max_logical_reads\n      , QS.total_physical_reads\n      , QS.max_physical_reads\n      , QPlan.query_plan\n      , CP.cacheobjtype\n      , CP.objtype\n      , CP.size_in_bytes\nfrom    sys.dm_exec_query_stats                          as QS\n        cross apply sys.dm_exec_sql_text(QS.plan_handle) as QText\n        cross apply sys.dm_exec_query_plan(QS.plan_handle) as QPlan\n        inner join sys.databases            as D1\n                   on QText.dbid = D1.database_id\n        inner join sys.dm_exec_cached_plans as CP\n                   on CP.plan_handle = QS.plan_handle\nwhere   QText.text like '%usp_GlobalCashFlowRefresh%';<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\"\"\"\r\npostgresverification.py\r\n\r\nThe script performs the following:\r\n1. Reads the PostgreSQL configuration file\r\n2. Outputs the current values of the settings to the console\r\n    a. If the setting is not set, then \"Not Set\" is displayed\r\n    b. If the setting is commented out, then \"Commented Out\" is displayed\r\n3. Appends the results to a JSON file\r\n\r\nThe results are appended to the file in JSON format.\r\nThe file is created if it doesn't exist.\r\n\r\nAuthor: Rudy Rodarte\r\nDate: 2023-09-25\r\n\r\nUsage: python postgresverification.py &#91;path_to_postgresql.conf]\r\n\"\"\"\n\n\"\"\"\r\nmongodbverification.py\r\n\r\nThe script performs the following:\r\n1. Reads the MongoDB configuration file\r\n2. Outputs the current values of the settings to the console\r\n  a. If the setting is not set, then \"Not Set\" is displayed\r\n  b. If the setting is commented out, then \"Commented Out\" is displayed\r\n3. Appends the results to a JSON file\r\n\r\nThe results are appended to the file in JSON format. \r\nThe file is created if it doesn't exist.\r\n\r\nAuthor: Rudy Rodarte\r\nDate: 2023-09-25\r\n\r\nUsage: python mongodbverification.py &#91;path_to_mongod.conf]\r\n\"\"\"\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Some Query Plan<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[43],"class_list":["post-256","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Query Plans - 77 Interactive<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/77interactive.com\/?p=256\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Query Plans - 77 Interactive\" \/>\n<meta property=\"og:description\" content=\"Some Query Plan\" \/>\n<meta property=\"og:url\" content=\"http:\/\/77interactive.com\/?p=256\" \/>\n<meta property=\"og:site_name\" content=\"77 Interactive\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-11T07:42:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-25T22:28:59+00:00\" \/>\n<meta name=\"author\" content=\"Rudy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rudy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/77interactive.com\/?p=256#article\",\"isPartOf\":{\"@id\":\"http:\/\/77interactive.com\/?p=256\"},\"author\":{\"name\":\"Rudy\",\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9\"},\"headline\":\"Query Plans\",\"datePublished\":\"2023-09-11T07:42:41+00:00\",\"dateModified\":\"2023-09-25T22:28:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/77interactive.com\/?p=256\"},\"wordCount\":5,\"keywords\":[\"sql\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/77interactive.com\/?p=256\",\"url\":\"http:\/\/77interactive.com\/?p=256\",\"name\":\"Query Plans - 77 Interactive\",\"isPartOf\":{\"@id\":\"http:\/\/77interactive.com\/#website\"},\"datePublished\":\"2023-09-11T07:42:41+00:00\",\"dateModified\":\"2023-09-25T22:28:59+00:00\",\"author\":{\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9\"},\"breadcrumb\":{\"@id\":\"http:\/\/77interactive.com\/?p=256#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/77interactive.com\/?p=256\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/77interactive.com\/?p=256#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/77interactive.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Query Plans\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/77interactive.com\/#website\",\"url\":\"http:\/\/77interactive.com\/\",\"name\":\"77 Interactive\",\"description\":\"Rudy&#039;s Code snippets\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/77interactive.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9\",\"name\":\"Rudy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/77interactive.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g\",\"caption\":\"Rudy\"},\"url\":\"http:\/\/77interactive.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Query Plans - 77 Interactive","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/77interactive.com\/?p=256","og_locale":"en_US","og_type":"article","og_title":"Query Plans - 77 Interactive","og_description":"Some Query Plan","og_url":"http:\/\/77interactive.com\/?p=256","og_site_name":"77 Interactive","article_published_time":"2023-09-11T07:42:41+00:00","article_modified_time":"2023-09-25T22:28:59+00:00","author":"Rudy","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rudy","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/77interactive.com\/?p=256#article","isPartOf":{"@id":"http:\/\/77interactive.com\/?p=256"},"author":{"name":"Rudy","@id":"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9"},"headline":"Query Plans","datePublished":"2023-09-11T07:42:41+00:00","dateModified":"2023-09-25T22:28:59+00:00","mainEntityOfPage":{"@id":"http:\/\/77interactive.com\/?p=256"},"wordCount":5,"keywords":["sql"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/77interactive.com\/?p=256","url":"http:\/\/77interactive.com\/?p=256","name":"Query Plans - 77 Interactive","isPartOf":{"@id":"http:\/\/77interactive.com\/#website"},"datePublished":"2023-09-11T07:42:41+00:00","dateModified":"2023-09-25T22:28:59+00:00","author":{"@id":"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9"},"breadcrumb":{"@id":"http:\/\/77interactive.com\/?p=256#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/77interactive.com\/?p=256"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/77interactive.com\/?p=256#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/77interactive.com\/"},{"@type":"ListItem","position":2,"name":"Query Plans"}]},{"@type":"WebSite","@id":"http:\/\/77interactive.com\/#website","url":"http:\/\/77interactive.com\/","name":"77 Interactive","description":"Rudy&#039;s Code snippets","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/77interactive.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/77interactive.com\/#\/schema\/person\/0e61d2a984b8304618026b207e6121e9","name":"Rudy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/77interactive.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e336b9aecd39b40691ff8ccfcd68506415072dbe8caffc0485b94a1bc22b774d?s=96&d=mm&r=g","caption":"Rudy"},"url":"http:\/\/77interactive.com\/?author=1"}]}},"_links":{"self":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/posts\/256","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=256"}],"version-history":[{"count":0,"href":"http:\/\/77interactive.com\/index.php?rest_route=\/wp\/v2\/posts\/256\/revisions"}],"wp:attachment":[{"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=256"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/77interactive.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}