Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g6pnc-0001tV-CS for pgsql-general@arkaria.postgresql.org; Mon, 01 Oct 2018 04:27:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g6pnZ-0000H8-Ru for pgsql-general@arkaria.postgresql.org; Mon, 01 Oct 2018 04:27:09 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g6pnY-0000Gx-M7 for pgsql-general@lists.postgresql.org; Mon, 01 Oct 2018 04:27:09 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g6pnP-0000Q8-I4 for pgsql-general@lists.postgresql.org; Mon, 01 Oct 2018 04:27:06 +0000 Received: by mail-pg1-x544.google.com with SMTP id t70-v6so8477340pgd.12 for ; Sun, 30 Sep 2018 21:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zeit-io.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=qHwwcN7eTMzDoBa8/sGv3pX8e/MYnLSVzLNL4syeVCI=; b=hbXdEpQh2BQpbfvwYfqqxXRKqB4N24xzjQQhO5KqyRl5WVElwssboiupYp//5jQWvO lJRaAP+RqY0x5VHMZCis91hz4NzHqUF7Mz7FFEmL0D7G2UjfW9w6Em5aGyARyeCFuPFu fzBADb2NcC3USbe1B7ff1yurnRj4bn4tJnooF/XGLEHK/wYOTkWGVaA+9A4Q6Tv8AM7d rDvNIKD0pS46HwfdmCoPHOx4Od+yH4RAJ6cNPvDtrxwwl3kh26VoMH0GQ3mxzX3QqMf5 b1QvASgF2nyhedvZ3Hlm34EaQZmRGuwBz83ZM1zZYUlIYszO2ZUTyKIFH9cRNyZTBfFz RKWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=qHwwcN7eTMzDoBa8/sGv3pX8e/MYnLSVzLNL4syeVCI=; b=YK6ja4qbR5x67GQsYCU4hbsxHSW+k89eqqUHlizWZVQH4KkNikM9QffeOM/C8fLfFY q6w5ishunW2rwIqeKPhLa06Piop5K/JcvrLQZ49iaVlnGrrRs0Vt4zASP/h8ZSkLRzmA 4VkBskpoQt4d0thDutxkM3mhj8EuenObMRS9A5m17PJZrNxBXtbttWbW955xeF+EEgiz Gg3esTTyYfGDzUQO4TV3VvNbz/OJfUOO1JZLBq0NzK6/NVteNPsEZp0KkN/9g5+CzimZ LnlUiSZBrPBLtbA7lisUMtDF6k0s0wIarHGqGIGJFQmXp9xJ9IGQBe9FffCDwdzk9vFN MCGQ== X-Gm-Message-State: ABuFfohmSZyPq7a0UI0KkbeH+Hpl2GzczE8Ct0R7ccsXAHow+u6NOh4L dXUzSM0kzRrMTbqujxFajGHcGQ== X-Google-Smtp-Source: ACcGV60r+9hXXua/JQa02yHUVwk01k/4UKfXRuD6yRL/2dRJT4sQ6cl13vGcvtIaV8lK7Rm9x/7sKw== X-Received: by 2002:a62:1316:: with SMTP id b22-v6mr7843860pfj.37.1538368017667; Sun, 30 Sep 2018 21:26:57 -0700 (PDT) Received: from [192.168.0.100] ([45.123.160.163]) by smtp.gmail.com with ESMTPSA id h7-v6sm17461327pfd.155.2018.09.30.21.26.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Sep 2018 21:26:56 -0700 (PDT) From: Arup Rakshit Message-Id: <6F29D803-9EC7-4D80-BFDB-BDF740243A68@zeit.io> Content-Type: multipart/alternative; boundary="Apple-Mail=_756697D7-8550-4D9B-9C2A-AACC460495DD" Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: Why my query not using index to sort? Date: Mon, 1 Oct 2018 09:56:48 +0530 In-Reply-To: <50c0d333-b979-c34b-46bd-a686b429868f@aklaver.com> Cc: Andreas Kretschmer , pgsql-general@lists.postgresql.org To: Adrian Klaver References: <20311.1538141875@sss.pgh.pa.us> <97DDEE09-FE33-43DB-A451-665F3535B5BA@zeit.io> <40D9D4B8-7D62-4E6E-B6E9-3F83DACA2D45@zeit.io> <61708e66-dcc6-6490-b876-979eff8c3efd@a-kretschmer.de> <05A26EE2-964C-4F53-8DB5-CD86D3D46D86@zeit.io> <2c10559c-21fa-bb73-3814-cec5583ddb6c@aklaver.com> <327CBA05-3910-416D-B1E0-175C44A256AE@zeit.io> <2be603be-1506-5a3d-c086-1fdd11d83bd3@aklaver.com> <13BB58F6-A4D6-475A-A71A-F6B4CF780644@zeit.io> <761996F5-EF2E-48C9-A250-B41A63239E01@zeit.io> <658B2138-3146-4BE8-946F-827B1453A38E@zeit.io> <50c0d333-b979-c34b-46bd-a686b429868f@aklaver.com> X-Mailer: Apple Mail (2.3445.9.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_756697D7-8550-4D9B-9C2A-AACC460495DD Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello Adrian, The one I said in gist is different query, and the previous mail I = posted another query because I was testing with different types of = queries. So 1.5, 1.7 is not for this current one. My main point now I am = trying to understand why it is not matching at all. The current query = timing in psql and production log is very close, but not the explain = output. Regarding the file written time, I think it is not the time to write = into the file. Because If I don=E2=80=99t write this to the file still = it shows 14ms + always. I used the file not the sql output so that I can = paste here clean stuffs I want to show. If you want, I can show the = output without writing it to the external file, and you will see the = same time. docking_dev=3D# \timing on = = Timing is = on. docking_dev=3D# select = = "vessels" .* = = = from = = = "vessels" = = = where = = = "vessels"."deleted_at" is null = = and = "vessels"."company_id" in ('6f56abfe-a355-44b9-b728-a642f661a8e7', = = = 'c82d08d7-bec1-4413-b627-63e1898c568c', = = = '5404cd95-29d9-44c3-8ca3-261be373bf31', = = = '19d5224a-ff2b-43c4-b756-4e82c29a4712', = = = '6fed40b7-fdd7-4efb-a163-c2b42e6486ae', = = = 'a0793a69-330c-4a6b-8a55-ee6daf574371', = = = '3e936613-04e6-4db0-8595-5b8ae9cc2a40', = = = '059275e2-933d-4543-8eef-91a5af87849b', = = = 'c64a658a-6ff1-4e76-8551-dfa62383bac3', = = = 'ce634593-555a-4f3c-af79-d7a7cf3796fb', = = = 'e18c4dab-f536-46f8-9f85-8bf51dbe989e', = = = 'cfe6a534-b33b-4493-862e-6aa4f0b4a790', = = = '58d628c1-af0d-4e64-b672-87c77b677c7b', = = = '36cb8ab0-5e8a-40db-a296-5e4b5dc666f3', = = = '0d15288d-c042-461e-b4cb-0b2ad47ead29', = = = 'e8cd498d-9da5-4d54-ac07-e4fc48c84a67', = = = 'c192c117-0ec7-4c1d-94a6-0a773e70e58b', = = = '97dd15db-5862-4d49-9047-e3e0307e5c95', = = = '03766e4f-4f64-4927-be6d-a126958ac1a8', = = = '26987b95-8652-491c-b950-4fb3128f4714', = = = 'c4f55044-3f4e-439e-a586-8b6978c7b406', = = = '36825da8-2f58-4a62-bdb4-2b91cbe18299', = = = 'cca256cf-b415-472c-8b9f-a8432d02c580'); code | name | = = = = = = = = = = = = = = = = = = = = = = = = = = technical_details = = = = = = = = = = = = = = = = = = = = = = = = = | created_at | = updated_at | deleted_at | id | = company_id | vessel_category_id = =20 = ------------+-------------------------------------------+-----------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= ---------------------------------------------+----------------------------= +----------------------------+------------+-------------------------------= -------+--------------------------------------+---------------------------= ----------- HHS | Hamburg Star | = {"class_number":"9298325","owner_salutation":"Dear = Mr.","charterer":"Scorpio","overview_docking_dates":"2015-07-18T22:00:00.0= 00+00:00","cr_last_date":"2010-12-22","cr_due_date":"2010-12-21","edd_vess= el":"No","imo_number":"9298325","classification_society":"Lloyds = Register","flag_state":"Liberia","port_of_registry":"Monrovia","scantling_= deadweight":"73748,55","gross_tonnage":"41968","net_tonnage":"22047","brea= dth":"32,26","length_pp":"218,0","length_overall":"228,6","docking_draft":= "5,5","scantling_draft":"14,45","lightship_weight":"15000,07","type_of_ves= sel":"Oil/Product Carrier","main_engine_fuel_type":"IFO = 380","auxiliary_engines_maker":"Yanmar","auxiliary_engines_types":"8 = 21L-EV","auxiliary_engines_output":"900 kW","owner_name":"MT Hamburg = Star Schiffahrtsgesellschaft mbh \u0026 Co. = KG","official_number":"91186","commissioned":"2005-12-22","liquid_cargo_in= take":"83611,31","depth_to_main_deck":"20,8","class_assignment":"Oil / = Product, 100 A1 Oil tanker, ESP, *IWS, LI, LMC, UMS, = IGS","main_engine_type_and_make":"B \u0026 W 5S60 MC-C, 11.300 kW, 105 = rpm"} = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = | = 2015-06-29 13:19:44.449149 | 2015-07-09 07:21:43.842282 | | = 113e113d-9fbe-4429-99a6-c8ed306f9e29 | = e8cd498d-9da5-4d54-ac07-e4fc48c84a67 | = 18497ecf-5435-4e76-bc13-cda11f106457 4020 | Hansa Fyn | = {"vessels_registered_name":"Hansa Fyn","type_of_vessel":"Container = Geared","imo_number":"9256418","official_number":"20276","class_number":"1= 10280","builder_hull_number":"GWS 299","classification_society":"DNV = GL","class_assignment":"GL 100 A5 E CONTAINER SHIP, SOLAS II-2 Reg., 54 = IW","flag_state":"Grand Duchy of Luxembourg","port_of_registry":=E2=80=9DL= ux Time: 14.173 ms docking_dev=3D# docking_dev=3D# explain analyze select = = "vessels" .* = = = from = = = "vessels" = = = where = = = "vessels"."deleted_at" is null = = and = "vessels"."company_id" in ('6f56abfe-a355-44b9-b728-a642f661a8e7', = = = 'c82d08d7-bec1-4413-b627-63e1898c568c', = = = '5404cd95-29d9-44c3-8ca3-261be373bf31', = = = '19d5224a-ff2b-43c4-b756-4e82c29a4712', = = = '6fed40b7-fdd7-4efb-a163-c2b42e6486ae', = = = 'a0793a69-330c-4a6b-8a55-ee6daf574371', = = = '3e936613-04e6-4db0-8595-5b8ae9cc2a40', = = = '059275e2-933d-4543-8eef-91a5af87849b', = = = 'c64a658a-6ff1-4e76-8551-dfa62383bac3', = = = 'ce634593-555a-4f3c-af79-d7a7cf3796fb', = = = 'e18c4dab-f536-46f8-9f85-8bf51dbe989e', = = = 'cfe6a534-b33b-4493-862e-6aa4f0b4a790', = = = '58d628c1-af0d-4e64-b672-87c77b677c7b', = = = '36cb8ab0-5e8a-40db-a296-5e4b5dc666f3', = = = '0d15288d-c042-461e-b4cb-0b2ad47ead29', = = = 'e8cd498d-9da5-4d54-ac07-e4fc48c84a67', = = = 'c192c117-0ec7-4c1d-94a6-0a773e70e58b', = = = '97dd15db-5862-4d49-9047-e3e0307e5c95', = = = '03766e4f-4f64-4927-be6d-a126958ac1a8', = = = '26987b95-8652-491c-b950-4fb3128f4714', = = = 'c4f55044-3f4e-439e-a586-8b6978c7b406', = = = '36825da8-2f58-4a62-bdb4-2b91cbe18299', = = = 'cca256cf-b415-472c-8b9f-a8432d02c580'); = = = = = = QUERY PLAN = = = = = = =20 = --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= ---------------------------------- Seq Scan on vessels (cost=3D0.00..630.62 rows=3D923 width=3D1439) = (actual time=3D0.201..2.927 rows=3D753 loops=3D1) Filter: ((deleted_at IS NULL) AND (company_id =3D ANY = ('{6f56abfe-a355-44b9-b728-a642f661a8e7,c82d08d7-bec1-4413-b627-63e1898c56= 8c,5404cd95-29d9-44c3-8ca3-261be373bf31,19d5224a-ff2b-43c4-b756-4e82c29a47= 12,6fed40b7-fdd7-4efb-a163-c2b42e6486ae,a0793a69-330c-4a6b-8a55-ee6daf5743= 71,3e936613-04e6-4db0-8595-5b8ae9cc2a40,059275e2-933d-4543-8eef-91a5af8784= 9b,c64a658a-6ff1-4e76-8551-dfa62383bac3,ce634593-555a-4f3c-af79-d7a7cf3796= fb,e18c4dab-f536-46f8-9f85-8bf51dbe989e,cfe6a534-b33b-4493-862e-6aa4f0b4a7= 90,58d628c1-af0d-4e64-b672-87c77b677c7b,36cb8ab0-5e8a-40db-a296-5e4b5dc666= f3,0d15288d-c042-461e-b4cb-0b2ad47ead29,e8cd498d-9da5-4d54-ac07-e4fc48c84a= 67,c192c117-0ec7-4c1d-94a6-0a773e70e58b,97dd15db-5862-4d49-9047-e3e0307e5c= 95,03766e4f-4f64-4927-be6d-a126958ac1a8,26987b95-8652-491c-b950-4fb3128f47= 14,c4f55044-3f4e-439e-a586-8b6978c7b406,36825da8-2f58-4a62-bdb4-2b91cbe182= 99,cca256cf-b415-472c-8b9f-a8432d02c580}'::uuid[]))) Rows Removed by Filter: 1947 Planning time: 0.528 ms Execution time: 3.076 ms (5 rows) Thanks, Arup Rakshit ar@zeit.io > On 01-Oct-2018, at 3:15 AM, Adrian Klaver = wrote: >=20 > On 9/30/18 1:21 PM, Arup Rakshit wrote: >> Hi Adrian, >> I am on psql (10.5, server 9.5.14). >> I am still investigating the Rails side. I found a blog = (https://schneems.com/2015/10/27/sql-in-rails-logs.html = ) , where a = Rails core team member said that Load time is basically SQL execution = time. >=20 > =46rom what I read he said it is the SQL call, with no indication of = whether that includes the the ORM/framwork overhead to make the call or = not. >=20 >> I also had done a little test on psql. Here I also see the explain = output and actual execution time far apart and it matches what I see in = the Rails log. >=20 > No it does not. In a previous post you said: >=20 > "It takes now between 1.7 to 1.9 ms in production." >=20 > Which was confirmed by the information here: >=20 > https://gist.github.com/aruprakshit/a6bd7ca221c9a13cd583e0827aa24ad6 = >=20 > Below you show 5.046 ms and then 14.377 ms. The second number is not = really relevant as it includes the time to write out to a file, so is = different operation all together. >=20 >> docking_dev=3D# explain analyze select = = = "vessels" .* from = = = "vessels" = where = = = "vessels"."deleted_at" is null = and "vessels"."company_id" in = ('6f56abfe-a355-44b9-b728-a642f661a8e7', = = 'c82d08d7-bec1-4413-b627-63e1898c568c', = = = '5404cd95-29d9-44c3-8ca3-261be373bf31', = '19d5224a-ff2b-43c4-b756-4e82c29a4712', = = = '6fed40b7-fdd7-4efb-a163-c2b42e6486ae', = = = 'a0793a69-330c-4a6b-8a55-ee6daf574371', = '3e936613-04e6-4db0-8595-5b8ae9cc2a40', = = = '059275e2-933d-4543-8eef-91a5af87849b', = = = 'c64a658a-6ff1-4e76-8551-dfa62383bac3', = 'ce634593-555a-4f3c-af79-d7a7cf3796fb', = = = 'e18c4dab-f536-46f8-9f85-8bf51dbe989e', = = = 'cfe6a534-b33b-4493-862e-6aa4f0b4a790', = '58d628c1-af0d-4e64-b672-87c77b677c7b', = = = '36cb8ab0-5e8a-40db-a296-5e4b5dc666f3', = = = '0d15288d-c042-461e-b4cb-0b2ad47ead29', = 'e8cd498d-9da5-4d54-ac07-e4fc48c84a67', = = = 'c192c117-0ec7-4c1d-94a6-0a773e70e58b', = = = '97dd15db-5862-4d49-9047-e3e0307e5c95', = '03766e4f-4f64-4927-be6d-a126958ac1a8', = = = '26987b95-8652-491c-b950-4fb3128f4714', = = = 'c4f55044-3f4e-439e-a586-8b6978c7b406', = '36825da8-2f58-4a62-bdb4-2b91cbe18299', = = = 'cca256cf-b415-472c-8b9f-a8432d02c580'); >> = = = = QUERY PLAN >> = --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= ---------------------------------- >> Seq Scan on vessels (cost=3D0.00..630.62 rows=3D923 width=3D1439) = (actual time=3D0.279..4.921 rows=3D753 loops=3D1) >> Filter: ((deleted_at IS NULL) AND (company_id =3D ANY = ('{6f56abfe-a355-44b9-b728-a642f661a8e7,c82d08d7-bec1-4413-b627-63e1898c56= 8c,5404cd95-29d9-44c3-8ca3-261be373bf31,19d5224a-ff2b-43c4-b756-4e82c29a47= 12,6fed40b7-fdd7-4efb-a163-c2b42e6486ae,a0793a69-330c-4a6b-8a55-ee6daf5743= 71,3e936613-04e6-4db0-8595-5b8ae9cc2a40,059275e2-933d-4543-8eef-91a5af8784= 9b,c64a658a-6ff1-4e76-8551-dfa62383bac3,ce634593-555a-4f3c-af79-d7a7cf3796= fb,e18c4dab-f536-46f8-9f85-8bf51dbe989e,cfe6a534-b33b-4493-862e-6aa4f0b4a7= 90,58d628c1-af0d-4e64-b672-87c77b677c7b,36cb8ab0-5e8a-40db-a296-5e4b5dc666= f3,0d15288d-c042-461e-b4cb-0b2ad47ead29,e8cd498d-9da5-4d54-ac07-e4fc48c84a= 67,c192c117-0ec7-4c1d-94a6-0a773e70e58b,97dd15db-5862-4d49-9047-e3e0307e5c= 95,03766e4f-4f64-4927-be6d-a126958ac1a8,26987b95-8652-491c-b950-4fb3128f47= 14,c4f55044-3f4e-439e-a586-8b6978c7b406,36825da8-2f58-4a62-bdb4-2b91cbe182= 99,cca256cf-b415-472c-8b9f-a8432d02c580}'::uuid[]))) >> Rows Removed by Filter: 1947 >> Planning time: 2.249 ms >> Execution time: 5.046 ms >> (5 rows) >> docking_dev=3D# \timing on >> Timing is on. >> docking_dev=3D# \o ~/Downloads/a.txt = = = docking_dev=3D# select "vessels" .* = = = from = "vessels" = = = where = "vessels"."deleted_at" is null = = = and "vessels"."company_id" in = ('6f56abfe-a355-44b9-b728-a642f661a8e7', = = 'c82d08d7-bec1-4413-b627-63e1898c568c', = '5404cd95-29d9-44c3-8ca3-261be373bf31', = = = '19d5224a-ff2b-43c4-b756-4e82c29a4712', = = = '6fed40b7-fdd7-4efb-a163-c2b42e6486ae', = 'a0793a69-330c-4a6b-8a55-ee6daf574371', = = = '3e936613-04e6-4db0-8595-5b8ae9cc2a40', = = = '059275e2-933d-4543-8eef-91a5af87849b', = 'c64a658a-6ff1-4e76-8551-dfa62383bac3', = = = 'ce634593-555a-4f3c-af79-d7a7cf3796fb', = = = 'e18c4dab-f536-46f8-9f85-8bf51dbe989e', = 'cfe6a534-b33b-4493-862e-6aa4f0b4a790', = = = '58d628c1-af0d-4e64-b672-87c77b677c7b', = = = '36cb8ab0-5e8a-40db-a296-5e4b5dc666f3', = '0d15288d-c042-461e-b4cb-0b2ad47ead29', = = = 'e8cd498d-9da5-4d54-ac07-e4fc48c84a67', = = = 'c192c117-0ec7-4c1d-94a6-0a773e70e58b', = '97dd15db-5862-4d49-9047-e3e0307e5c95', = = = '03766e4f-4f64-4927-be6d-a126958ac1a8', = = = '26987b95-8652-491c-b950-4fb3128f4714', = 'c4f55044-3f4e-439e-a586-8b6978c7b406', = = = '36825da8-2f58-4a62-bdb4-2b91cbe18299', = = = 'cca256cf-b415-472c-8b9f-a8432d02c580'); >> Time: 14.377 ms >> docking_dev=3D# >> Thanks, >> Arup Rakshit >> ar@zeit.io > >>> On 29-Sep-2018, at 2:50 AM, Adrian Klaver >> wrote: >>>=20 >>> On 9/28/18 12:14 PM, Arup Rakshit wrote: >>>> Forgot to mention in my previous email, it was a quick send click. = Sorry for that. >>>> In the gist you need to see all the line with Vessel Load(.. . I = load the page multiple times to catch the different times, so you will = the line multiple times there in the log file. >>>=20 >>> Do you know what Vessel Load () is actually measuring? >>>=20 >>> To me it looks like it is covering both the query(including ROR = overhead) and the HTTP request/response cycle. >>>=20 >>> Also have you looked at: >>>=20 >>> = https://guides.rubyonrails.org/debugging_rails_applications.html#impact-of= -logs-on-performance >>>=20 >>>> Thanks, >>>> Arup Rakshit >>>> ar@zeit.io >>>=20 >>>=20 >>> --=20 >>> Adrian Klaver >>> adrian.klaver@aklaver.com >=20 >=20 > --=20 > Adrian Klaver > adrian.klaver@aklaver.com --Apple-Mail=_756697D7-8550-4D9B-9C2A-AACC460495DD Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Hello Adrian,

The one I said in gist is different query, and the previous = mail I posted another query because I was testing with different types = of queries. So 1.5, 1.7 is not for this current one. My main point now I = am trying to understand why it is not matching at all. The current query = timing in psql and production log is very close, but not the explain = output.

Regarding the file written time, I think it is not the time = to write into the file. Because If I don=E2=80=99t write this to the = file still it shows 14ms + always. I used the file not the sql output so = that I can paste here clean stuffs I want to show. If you want, I can = show the output without writing it to the external file, and you will = see the same time.


docking_dev=3D# \timing on          =                     =                     =                     =                     =                     =                     =                     =                     =           Timing is on.
docking_dev=3D# select    =                     =                     =                     =                     =                     =                     =                     =                     =                     = "vessels" .*                =                     =                     =                     =                     =                     =                     =                     =                     =                 from  =                     =                     =                     =                     =                     =                     =                     =                     =                     =                   "vessels" =                     =                     =                     =                     =                     =                     =                     =                     =                     =               where     =                     =                     =                     =                     =                     =                     =                     =                     =                     =               "vessels"."deleted_at" = is null                  =                     =                     =                     =                     =                     =                     =                     =                 and = "vessels"."company_id" in ('6f56abfe-a355-44b9-b728-a642f661a8e7',  =                     =                     =                     =                     =                     =                     =             = 'c82d08d7-bec1-4413-b627-63e1898c568c',         =                     =                     =                     =                     =                     =                     =                     =                 = '5404cd95-29d9-44c3-8ca3-261be373bf31',         =                     =                     =                     =                     =                     =                     =                     =                 = '19d5224a-ff2b-43c4-b756-4e82c29a4712',         =                     =                     =                     =                     =                     =                     =                     =                 = '6fed40b7-fdd7-4efb-a163-c2b42e6486ae',         =                     =                     =                     =                     =                     =                     =                     =                 = 'a0793a69-330c-4a6b-8a55-ee6daf574371',         =                     =                     =                     =                     =                     =                     =                     =                 = '3e936613-04e6-4db0-8595-5b8ae9cc2a40',         =                     =                     =                     =                     =                     =                     =                     =                 = '059275e2-933d-4543-8eef-91a5af87849b',         =                     =                     =                     =                     =                     =                     =                     =                 = 'c64a658a-6ff1-4e76-8551-dfa62383bac3',         =                     =                     =                     =                     =                     =                     =                     =                 = 'ce634593-555a-4f3c-af79-d7a7cf3796fb',         =                     =                     =                     =                     =                     =                     =                     =                 = 'e18c4dab-f536-46f8-9f85-8bf51dbe989e',         =                     =                     =                     =                     =                     =                     =                     =                 = 'cfe6a534-b33b-4493-862e-6aa4f0b4a790',         =                     =                     =                     =                     =                     =                     =                     =                 = '58d628c1-af0d-4e64-b672-87c77b677c7b',         =                     =                     =                     =                     =                     =                     =                     =                 = '36cb8ab0-5e8a-40db-a296-5e4b5dc666f3',         =                     =                     =                     =                     =                     =                     =                     =                 = '0d15288d-c042-461e-b4cb-0b2ad47ead29',         =                     =                     =                     =                     =                     =                     =                     =                 = 'e8cd498d-9da5-4d54-ac07-e4fc48c84a67',         =                     =                     =                     =                     =                     =                     =                     =                 = 'c192c117-0ec7-4c1d-94a6-0a773e70e58b',         =                     =                     =                     =                     =                     =                     =                     =                 = '97dd15db-5862-4d49-9047-e3e0307e5c95',         =                     =                     =                     =                     =                     =                     =                     =                 = '03766e4f-4f64-4927-be6d-a126958ac1a8',         =                     =                     =                     =                     =                     =                     =                     =                 = '26987b95-8652-491c-b950-4fb3128f4714',         =                     =                     =                     =                     =                     =                     =                     =                 = 'c4f55044-3f4e-439e-a586-8b6978c7b406',         =                     =                     =                     =                     =                     =                     =                     =                 = '36825da8-2f58-4a62-bdb4-2b91cbe18299',         =                     =                     =                     =                     =                     =                     =                     =                 = 'cca256cf-b415-472c-8b9f-a8432d02c580');
    code    |         =           name        =             |         =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =       technical_details          =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =       |         created_at   =       |         updated_at   =       | deleted_at |          =         id            =       |              = company_id              |  =         vessel_category_id       =    
------------+-------------------------------------------+------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------+-----------------= -----------+----------------------------+------------+--------------------= ------------------+--------------------------------------+----------------= ----------------------
 HHS        | Hamburg Star  =                     =         | = {"class_number":"9298325","owner_salutation":"Dear = Mr.","charterer":"Scorpio","overview_docking_dates":"2015-07-18T22:00:00.0= 00+00:00","cr_last_date":"2010-12-22","cr_due_date":"2010-12-21","edd_vess= el":"No","imo_number":"9298325","classification_society":"Lloyds = Register","flag_state":"Liberia","port_of_registry":"Monrovia","scantling_= deadweight":"73748,55","gross_tonnage":"41968","net_tonnage":"22047","brea= dth":"32,26","length_pp":"218,0","length_overall":"228,6","docking_draft":= "5,5","scantling_draft":"14,45","lightship_weight":"15000,07","type_of_ves= sel":"Oil/Product Carrier","main_engine_fuel_type":"IFO = 380","auxiliary_engines_maker":"Yanmar","auxiliary_engines_types":"8 = 21L-EV","auxiliary_engines_output":"900 kW","owner_name":"MT Hamburg = Star Schiffahrtsgesellschaft mbh \u0026 Co. = KG","official_number":"91186","commissioned":"2005-12-22","liquid_cargo_in= take":"83611,31","depth_to_main_deck":"20,8","class_assignment":"Oil / = Product, 100 A1 Oil tanker, ESP, *IWS, LI, LMC, UMS, = IGS","main_engine_type_and_make":"B \u0026 W 5S60 MC-C, 11.300 kW, 105 = rpm"}                   =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                 | 2015-06-29 = 13:19:44.449149 | 2015-07-09 07:21:43.842282 |      =       | 113e113d-9fbe-4429-99a6-c8ed306f9e29 | = e8cd498d-9da5-4d54-ac07-e4fc48c84a67 | = 18497ecf-5435-4e76-bc13-cda11f106457
 4020       | Hansa Fyn     =                     =         | {"vessels_registered_name":"Hansa = Fyn","type_of_vessel":"Container = Geared","imo_number":"9256418","official_number":"20276","class_number":"1= 10280","builder_hull_number":"GWS 299","classification_society":"DNV = GL","class_assignment":"GL 100 A5 E CONTAINER SHIP, SOLAS II-2 Reg., 54 = IW","flag_state":"Grand Duchy of = Luxembourg","port_of_registry":=E2=80=9DLux
Time: = 14.173 ms
docking_dev=3D#
docking_dev=3D# explain analyze select      =                     =                     =                     =                     =                     =                     =                     =                     =   "vessels" .*              =                     =                     =                     =                     =                     =                     =                     =                     =                   = from                  =                     =                     =                     =                     =                     =                     =                     =                     =                     =   "vessels"                 =                     =                     =                     =                     =                     =                     =                     =                     =                   where =                     =                     =                     =                     =                     =                     =                     =                     =                     =                   = "vessels"."deleted_at" is null            =                     =                     =                     =                     =                     =                     =                     =                     =   and "vessels"."company_id" in = ('6f56abfe-a355-44b9-b728-a642f661a8e7',        =                     =                     =                     =                     =                     =                     =       'c82d08d7-bec1-4413-b627-63e1898c568c',   =                     =                     =                     =                     =                     =                     =                     =                     =   '5404cd95-29d9-44c3-8ca3-261be373bf31',       =                     =                     =                     =                     =                     =                     =                     =                   = '19d5224a-ff2b-43c4-b756-4e82c29a4712',         =                     =                     =                     =                     =                     =                     =                     =                 = '6fed40b7-fdd7-4efb-a163-c2b42e6486ae',         =                     =                     =                     =                     =                     =                     =                     =                 = 'a0793a69-330c-4a6b-8a55-ee6daf574371',         =                     =                     =                     =                     =                     =                     =                     =                 = '3e936613-04e6-4db0-8595-5b8ae9cc2a40',         =                     =                     =                     =                     =                     =                     =                     =                 = '059275e2-933d-4543-8eef-91a5af87849b',         =                     =                     =                     =                     =                     =                     =                     =                 = 'c64a658a-6ff1-4e76-8551-dfa62383bac3',         =                     =                     =                     =                     =                     =                     =                     =                 = 'ce634593-555a-4f3c-af79-d7a7cf3796fb',         =                     =                     =                     =                     =                     =                     =                     =                 = 'e18c4dab-f536-46f8-9f85-8bf51dbe989e',         =                     =                     =                     =                     =                     =                     =                     =                 = 'cfe6a534-b33b-4493-862e-6aa4f0b4a790',         =                     =                     =                     =                     =                     =                     =                     =                 = '58d628c1-af0d-4e64-b672-87c77b677c7b',         =                     =                     =                     =                     =                     =                     =                     =                 = '36cb8ab0-5e8a-40db-a296-5e4b5dc666f3',         =                     =                     =                     =                     =                     =                     =                     =                 = '0d15288d-c042-461e-b4cb-0b2ad47ead29',         =                     =                     =                     =                     =                     =                     =                     =                 = 'e8cd498d-9da5-4d54-ac07-e4fc48c84a67',         =                     =                     =                     =                     =                     =                     =                     =                 = 'c192c117-0ec7-4c1d-94a6-0a773e70e58b',         =                     =                     =                     =                     =                     =                     =                     =                 = '97dd15db-5862-4d49-9047-e3e0307e5c95',         =                     =                     =                     =                     =                     =                     =                     =                 = '03766e4f-4f64-4927-be6d-a126958ac1a8',         =                     =                     =                     =                     =                     =                     =                     =                 = '26987b95-8652-491c-b950-4fb3128f4714',         =                     =                     =                     =                     =                     =                     =                     =                 = 'c4f55044-3f4e-439e-a586-8b6978c7b406',         =                     =                     =                     =                     =                     =                     =                     =                 = '36825da8-2f58-4a62-bdb4-2b91cbe18299',         =                     =                     =                     =                     =                     =                     =                     =                 = 'cca256cf-b415-472c-8b9f-a8432d02c580');
  =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =               QUERY PLAN   =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =                     =              
---------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= ---------------------------------------------
 Seq Scan on vessels  (cost=3D0.00..630.62 rows=3D923= width=3D1439) (actual time=3D0.201..2.927 rows=3D753 = loops=3D1)
   Filter: ((deleted_at IS = NULL) AND (company_id =3D ANY = ('{6f56abfe-a355-44b9-b728-a642f661a8e7,c82d08d7-bec1-4413-b627-63e1898c56= 8c,5404cd95-29d9-44c3-8ca3-261be373bf31,19d5224a-ff2b-43c4-b756-4e82c29a47= 12,6fed40b7-fdd7-4efb-a163-c2b42e6486ae,a0793a69-330c-4a6b-8a55-ee6daf5743= 71,3e936613-04e6-4db0-8595-5b8ae9cc2a40,059275e2-933d-4543-8eef-91a5af8784= 9b,c64a658a-6ff1-4e76-8551-dfa62383bac3,ce634593-555a-4f3c-af79-d7a7cf3796= fb,e18c4dab-f536-46f8-9f85-8bf51dbe989e,cfe6a534-b33b-4493-862e-6aa4f0b4a7= 90,58d628c1-af0d-4e64-b672-87c77b677c7b,36cb8ab0-5e8a-40db-a296-5e4b5dc666= f3,0d15288d-c042-461e-b4cb-0b2ad47ead29,e8cd498d-9da5-4d54-ac07-e4fc48c84a= 67,c192c117-0ec7-4c1d-94a6-0a773e70e58b,97dd15db-5862-4d49-9047-e3e0307e5c= 95,03766e4f-4f64-4927-be6d-a126958ac1a8,26987b95-8652-491c-b950-4fb3128f47= 14,c4f55044-3f4e-439e-a586-8b6978c7b406,36825da8-2f58-4a62-bdb4-2b91cbe182= 99,cca256cf-b415-472c-8b9f-a8432d02c580}'::uuid[])))
   Rows Removed by Filter: 1947
 Planning time: 0.528 ms
 Execution time: 3.076 ms
(5 rows)



Thanks,

Arup = Rakshit



On 01-Oct-2018, at 3:15 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:

On 9/30/18 1:21 PM, Arup Rakshit = wrote:
Hi = Adrian,
I am on psql (10.5, server 9.5.14).
I = am still investigating the Rails side. I found a blog (https://schneems.com/2015/10/27/sql-in-rails-logs.html) , = where a Rails core team member said that Load time is basically SQL = execution time.

=46rom what I read he said it is the SQL call, with no = indication of whether that includes the the ORM/framwork overhead to = make the call or not.

I also had done a little test on = psql. Here I also see the explain output and actual execution time far = apart and it matches what I see in the Rails log.

No it does not. In a previous post you said:

"It takes now between 1.7 to 1.9 = ms in production."

Which was confirmed by the information here:

https://gist.github.com/aruprakshit/a6bd7ca221c9a13cd583e0827aa= 24ad6

Below you = show 5.046 ms and then 14.377 ms. The second number is not really = relevant as it includes the time to write out to a file, so is different = operation all together.

docking_dev=3D# explain analyze = select =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =                     =                     =                   "vessels" = .* =             &n= bsp;           &nbs= p;            =    from =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;                 =                     =     "vessels" =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;  where =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =                 = "vessels"."deleted_at" is null =             &n= bsp;           &nbs= p;      and "vessels"."company_id" in = ('6f56abfe-a355-44b9-b728-a642f661a8e7', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;                =                     = 'c82d08d7-bec1-4413-b627-63e1898c568c', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =                    = '5404cd95-29d9-44c3-8ca3-261be373bf31', =        = '19d5224a-ff2b-43c4-b756-4e82c29a4712', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '6fed40b7-fdd7-4efb-a163-c2b42e6486ae', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'a0793a69-330c-4a6b-8a55-ee6daf574371', =             &n= bsp;           &nbs= p; '3e936613-04e6-4db0-8595-5b8ae9cc2a40', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '059275e2-933d-4543-8eef-91a5af87849b', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'c64a658a-6ff1-4e76-8551-dfa62383bac3', =             &n= bsp;           &nbs= p;    'ce634593-555a-4f3c-af79-d7a7cf3796fb', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'e18c4dab-f536-46f8-9f85-8bf51dbe989e', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'cfe6a534-b33b-4493-862e-6aa4f0b4a790', =             &n= bsp;           &nbs= p;   '58d628c1-af0d-4e64-b672-87c77b677c7b', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '36cb8ab0-5e8a-40db-a296-5e4b5dc666f3', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '0d15288d-c042-461e-b4cb-0b2ad47ead29', =             &n= bsp;           &nbs= p; 'e8cd498d-9da5-4d54-ac07-e4fc48c84a67', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'c192c117-0ec7-4c1d-94a6-0a773e70e58b', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '97dd15db-5862-4d49-9047-e3e0307e5c95', =             &n= bsp;            = '03766e4f-4f64-4927-be6d-a126958ac1a8', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '26987b95-8652-491c-b950-4fb3128f4714', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'c4f55044-3f4e-439e-a586-8b6978c7b406', =             &n= bsp;           &nbs= p;    '36825da8-2f58-4a62-bdb4-2b91cbe18299', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'cca256cf-b415-472c-8b9f-a8432d02c580');=
          &nb= sp;            = ;            &= nbsp;           &nb= sp;            = ;            &= nbsp;           &nb= sp;            = ;            &= nbsp;           &nb= sp;            = ;            &= nbsp;           &nb= sp;            = ;            &= nbsp;           &nb= sp;            = ;            &= nbsp;           &nb= sp;            = ;            &= nbsp;           &nb= sp;            = ;       QUERY PLAN
---------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= --------------------------------------------------------------------------= ---------------------------------------------
 Seq = Scan on vessels  (cost=3D0.00..630.62 rows=3D923 width=3D1439) = (actual time=3D0.279..4.921 rows=3D753 loops=3D1)
   Filter: ((deleted_at IS = NULL) AND (company_id =3D ANY = ('{6f56abfe-a355-44b9-b728-a642f661a8e7,c82d08d7-bec1-4413-b627-63e1898c56= 8c,5404cd95-29d9-44c3-8ca3-261be373bf31,19d5224a-ff2b-43c4-b756-4e82c29a47= 12,6fed40b7-fdd7-4efb-a163-c2b42e6486ae,a0793a69-330c-4a6b-8a55-ee6daf5743= 71,3e936613-04e6-4db0-8595-5b8ae9cc2a40,059275e2-933d-4543-8eef-91a5af8784= 9b,c64a658a-6ff1-4e76-8551-dfa62383bac3,ce634593-555a-4f3c-af79-d7a7cf3796= fb,e18c4dab-f536-46f8-9f85-8bf51dbe989e,cfe6a534-b33b-4493-862e-6aa4f0b4a7= 90,58d628c1-af0d-4e64-b672-87c77b677c7b,36cb8ab0-5e8a-40db-a296-5e4b5dc666= f3,0d15288d-c042-461e-b4cb-0b2ad47ead29,e8cd498d-9da5-4d54-ac07-e4fc48c84a= 67,c192c117-0ec7-4c1d-94a6-0a773e70e58b,97dd15db-5862-4d49-9047-e3e0307e5c= 95,03766e4f-4f64-4927-be6d-a126958ac1a8,26987b95-8652-491c-b950-4fb3128f47= 14,c4f55044-3f4e-439e-a586-8b6978c7b406,36825da8-2f58-4a62-bdb4-2b91cbe182= 99,cca256cf-b415-472c-8b9f-a8432d02c580}'::uuid[])))
   Rows Removed by Filter: = 1947
 Planning time: 2.249 ms
 Execution time: 5.046 ms
(5 rows)
docking_dev=3D# \timing on
Timing is on.
docking_dev=3D# \o ~/Downloads/a.txt =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;          docking_de= v=3D# select =             &n= bsp;           = "vessels" .* =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;               =                     =                     =   from =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;       "vessels" =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;            =                     =     where =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;    "vessels"."deleted_at" is null =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;   and "vessels"."company_id" in = ('6f56abfe-a355-44b9-b728-a642f661a8e7', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;                =                     = 'c82d08d7-bec1-4413-b627-63e1898c568c', =             &n= bsp;           &nbs= p;     '5404cd95-29d9-44c3-8ca3-261be373bf31', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;      '19d5224a-ff2b-43c4-b756-4e82c29a4712', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '6fed40b7-fdd7-4efb-a163-c2b42e6486ae', =             &n= bsp;           &nbs= p;   'a0793a69-330c-4a6b-8a55-ee6daf574371', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '3e936613-04e6-4db0-8595-5b8ae9cc2a40', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '059275e2-933d-4543-8eef-91a5af87849b', =             &n= bsp;           &nbs= p;  'c64a658a-6ff1-4e76-8551-dfa62383bac3', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'ce634593-555a-4f3c-af79-d7a7cf3796fb', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'e18c4dab-f536-46f8-9f85-8bf51dbe989e', =             &n= bsp;           &nbs= p;      'cfe6a534-b33b-4493-862e-6aa4f0b4a790', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '58d628c1-af0d-4e64-b672-87c77b677c7b', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '36cb8ab0-5e8a-40db-a296-5e4b5dc666f3', =             &n= bsp;           &nbs= p; '0d15288d-c042-461e-b4cb-0b2ad47ead29', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'e8cd498d-9da5-4d54-ac07-e4fc48c84a67', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'c192c117-0ec7-4c1d-94a6-0a773e70e58b', =             &n= bsp;           &nbs= p;  '97dd15db-5862-4d49-9047-e3e0307e5c95', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '03766e4f-4f64-4927-be6d-a126958ac1a8', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '26987b95-8652-491c-b950-4fb3128f4714', =             &n= bsp;           &nbs= p;  'c4f55044-3f4e-439e-a586-8b6978c7b406', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     '36825da8-2f58-4a62-bdb4-2b91cbe18299', =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;           &nbs= p;            =             &n= bsp;     'cca256cf-b415-472c-8b9f-a8432d02c580');=
Time: 14.377 ms
docking_dev=3D#
Thanks,
Arup Rakshit
ar@zeit.io <mailto:ar@zeit.io>
On 29-Sep-2018, at 2:50 = AM, Adrian Klaver <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:

On 9/28/18 12:14 PM, Arup Rakshit wrote:
Forgot to mention in my = previous email, it was a quick send click. Sorry for that.
In the gist you need to see all the line with Vessel = Load(.. . I load the page multiple times to catch the different times, = so you will the line multiple times there in the log file.

Do you know what Vessel Load () = is actually measuring?

To me it looks like = it is covering both the query(including ROR overhead) and the HTTP = request/response cycle.

Also have you = looked at:

https://guides.rubyonrails.org/debugging_rails_applications.htm= l#impact-of-logs-on-performance

Thanks,
Arup= Rakshit
ar@zeit.io <mailto:ar@zeit.io>


-- 
Adrian = Klaver
adrian.klaver@aklaver.com


-- Adrian Klaver
adrian.klaver@aklaver.com

= --Apple-Mail=_756697D7-8550-4D9B-9C2A-AACC460495DD--