| ms | bytes | objects | queries | query (ms) | rows | comments |
|---|---|---|---|---|---|---|
| 290.5 | 21,380,122* | 225,801 | 2 | 28.0 | 1,598 | before |
| 244.9 | 18,410,393* | 188,824 | 1 | 4.6 | after |
* Memory usage does not reflect 262 freed objects. (for both of them)
| def reload_models | |
| [Vm, Host, Storage].each { |m| m.update_all(:last_perf_capture_on => 50.minutes.ago) } # <== still tweaking | |
| [MiqTask, MiqQueue, Metric, MetricRollup, VimPerformanceState].each { |m| m.truncate} | |
| ActiveRecord::Base.connection.execute("vacuum full") | |
| Module.clear_all_cache_with_timeout | |
| [[MiqProductFeature, :@feature_cache], [MiqProductFeature, :@obj_cache], [BottleneckEvent, :@event_definitions], | |
| [Tenant, :@root_tenant]].each { |i, ivar| i.instance_variable_set(ivar, nil) } | |
| MiqServer.my_server ; MiqServer.my_zone | |
| [ExtManagementSystem, Host, EmsCluster, Tagging, Tag, HostStorage, Storage, Vm, MiqRegion, MiqTask, Relationship, Disk, | |
| Endpoint, Authentication, ServerRole, MiqWorker, MiqQueue, MetricRollup, BottleneckEvent].each { |m| m.first } |
| <html> | |
| <head><style> | |
| table {border-collapse:collapse;} | |
| table, td, th { border:1px solid black; } | |
| .f0, a.f0 { color: #999; } | |
| .f1, a.f1 { color: #ccc; } | |
| </style> | |
| </head> | |
| <body> | |
| <h2>!</h2> |
| #!/usr/bin/env ruby | |
| require 'thread' | |
| COLLECTOR_COUNT = 2 # define to run in separate threads. comment to run inline | |
| class Db | |
| def initialize | |
| @mutex = Mutex.new | |
| @data = {} | |
| end | |
| def []=(n, v) ; @mutex.synchronize { @data[n] = v } ; end |
| #!/usr/bin/env ruby | |
| begin | |
| require "bundler/inline" | |
| rescue LoadError => e | |
| $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
| raise e | |
| end | |
| gemfile(true) do |
| ms | bytes | objects | queries | query (ms) | rows | comments |
|---|---|---|---|---|---|---|
| 290.5 | 21,380,122* | 225,801 | 2 | 28.0 | 1,598 | before |
| 244.9 | 18,410,393* | 188,824 | 1 | 4.6 | after |
* Memory usage does not reflect 262 freed objects. (for both of them)
| require 'benchmark/ips' | |
| def eval_eval_true | |
| name = "Benchmark" | |
| eval("defined?(#{name}) && #{name}.class").to_s.eql?('Module') | |
| end | |
| def eval_eval_false | |
| name = "XABCDE" | |
| eval("defined?(#{name}) && #{name}.class").to_s.eql?('Module') |
| create index i_hosts_i_h on hosts(name, id); | |
| create index i_hosts_h_i on hosts(id, name); | |
| explain analyze verbose | |
| SELECT "vms".id FROM "vms" left join "hosts" on "hosts"."id" = "vms"."host_id" ORDER BY "hosts"."name" | |
| ; | |
| QUERY PLAN | |
| ----------------------------------------------------------------------------------------------------------------------------- | |
| Sort (cost=440.76..448.26 rows=3000 width=36) (actual time=30.724..30.884 rows=3000 loops=1) | |
| Output: vms.id, hosts.name |
My comments on 7388
- s = MiqSearch.find(@sb[:planning][:options][:filter_value])
- s.options ||= {}
- s.options[:userid] = session[:userid]
- s.options[:results_format] = :objects
-vms, attrs = s.search
+ vms = MiqSearch.find(@sb[:planning][:options][:filter_value]).filtered(nil, :userid => current_user)create table tst(val int);
insert into tst values(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);select val from tst where (val=2) and (mod(val,2)=0) or (val >= 6);| val |
| WITH RECURSIVE search_tree(id, path) AS ( | |
| SELECT id, ARRAY[id] | |
| FROM services | |
| WHERE id = 42 | |
| UNION ALL | |
| SELECT services.id, path || services.id | |
| FROM search_tree | |
| JOIN services ON services.service_id = search_tree.id | |
| WHERE NOT services.id = ANY(path) | |
| ) |