Sha256: bac7766edcf993fe0de8af13fcbe01b0176b7a35e5663b207dddb98481ca95f3

Contents?: true

Size: 1.04 KB

Versions: 13

Compression:

Stored size: 1.04 KB

Contents

class PathResponseTimeView < ActiveRecord::Migration
  def up
  	execute <<-SQL
  	DROP VIEW IF EXISTS #{Landable.configuration.database_schema_prefix}landable_traffic.path_response_time__by_time;
	CREATE OR REPLACE VIEW #{Landable.configuration.database_schema_prefix}landable_traffic.path_response_time__by_time
	AS
	SELECT *
	FROM
	(
		SELECT
		 p.path_id as path_id
		, p.path as path
		,round(avg(pv.response_time), 3) as "average response time (ms)"
		FROM #{Landable.configuration.database_schema_prefix}landable_traffic.page_views pv
		  JOIN #{Landable.configuration.database_schema_prefix}landable_traffic.paths p
		    on p.path_id = pv.path_id
		group by p.path_id, p.path
	) agg1
	order by agg1."average response time (ms)" desc
	;

	COMMENT ON VIEW #{Landable.configuration.database_schema_prefix}landable_traffic.path_response_time__by_time IS $$ The view path_response_time__by_time returns the paths displayed and the average reponse time (in ms) for each page of the site.  This list is ordered by response time, decending.$$;
  SQL
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
landable-1.13.1 db/migrate/20140602213937_path_response_time_view.rb
landable-1.12.3 db/migrate/20140602213937_path_response_time_view.rb
landable-1.12.2 db/migrate/20140602213937_path_response_time_view.rb
landable-1.12.1 db/migrate/20140602213937_path_response_time_view.rb
landable-1.11.1 db/migrate/20140602213937_path_response_time_view.rb
landable-1.11.0 db/migrate/20140602213937_path_response_time_view.rb
landable-1.10.0.rc2 db/migrate/20140602213937_path_response_time_view.rb
landable-1.10.0.rc1 db/migrate/20140602213937_path_response_time_view.rb
landable-1.9.2 db/migrate/20140602213937_path_response_time_view.rb
landable-1.9.1 db/migrate/20140602213937_path_response_time_view.rb
landable-1.9.0 db/migrate/20140602213937_path_response_time_view.rb
landable-1.9.0.rc2 db/migrate/20140602213937_path_response_time_view.rb
landable-1.9.0.rc1 db/migrate/20140602213937_path_response_time_view.rb