pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dinesh Chandra 12108 <Dinesh.Chandra@cyient.com>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: FW:  Re: Query is running very slow......
Date: Thu, 25 May 2017 12:26:54 +0000
Message-ID: <39b30cfde27a48898340a69940581727@cyient.com> (raw)
In-Reply-To: <4caed7cc-07d8-e364-78ca-7a96b9780a9d@2ndquadrant.com>
References: <3152be5a435f45649cef6bf9321beb9a@cyient.com>
	<4caed7cc-07d8-e364-78ca-7a96b9780a9d@2ndquadrant.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Hi Tomas,

Please find the below input for slow query.

(a) something about the hardware it's running on
 RAM-->64 GB, CPU->40core

(b) amounts of data in the tables / databases
Database size 	:32GB
-----------------
Tables size
-----------------
Workflow.project		: 8194 byte
workflow.tool_performance	:175 MB
workflow.evidence_to_do	:580 MB

(c) EXPLAIN or even better EXPLAIN ANALYZE of the query

"GroupAggregate  (cost=16583736169.63..18157894828.18 rows=5920110 width=69)"
"  ->  Sort  (cost=16583736169.63..16714893857.43 rows=52463075120 width=69)"
"        Sort Key: tool_performance.project_id, project.project_name, tool_performance.step_id, (date_trunc('day'::text, tool_performance.insert_time)), tool_performance.user_id"
"        ->  Nested Loop  (cost=2.42..787115179.07 rows=52463075120 width=69)"
"              ->  Seq Scan on evidence_to_do  (cost=0.00..119443.95 rows=558296 width=0)"
"                    Filter: (status_id = ANY ('{15100,15150,15200,15300,15400,15500}'::bigint[]))"
"              ->  Materialize  (cost=2.42..49843.24 rows=93970 width=69)"
"                    ->  Hash Join  (cost=2.42..49373.39 rows=93970 width=69)"
"                          Hash Cond: (tool_performance.project_id = project.project_id)"
"                          ->  Seq Scan on tool_performance  (cost=0.00..48078.88 rows=93970 width=39)"
"                                Filter: ((insert_time > '2017-05-01 00:00:00+05:30'::timestamp with time zone) AND (insert_time < '2017-05-02 00:00:00+05:30'::timestamp with time zone))"
"                          ->  Hash  (cost=1.63..1.63 rows=63 width=38)"
"                                ->  Seq Scan on project  (cost=0.00..1.63 rows=63 width=38)"

(d) configuration of the database (work_mem, shared_buffers etc.)

work_mem = 32MB
shared_buffers = 16GB
maintenance_work_mem = 8GB
temp_buffers = 64MB
max_connections=2000	

Regards,
Dinesh Chandra
|Database administrator (Oracle/PostgreSQL)| Cyient Ltd. Noida.
------------------------------------------------------------------
Mobile: +91-9953975849 | Ext 1078 |dinesh.chandra@cyient.com 
Plot No. 7, NSEZ, Phase-II ,Noida-Dadri Road, Noida - 201 305,India.

-----Original Message-----
From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Tomas Vondra
Sent: 24 May, 2017 10:56 PM
To: pgsql-performance@postgresql.org
Subject: [EXTERNAL] Re: [PERFORM] Query is running very slow......

Hi,

On 5/24/17 7:04 PM, Dinesh Chandra 12108 wrote:
> Dear Expert,
> 
> While executing the blow query, its taking too long time to fetch output.
> 
> Could you please help to fine tune the same?
> 

You'll have to provide far more details - the query alone is certainly not enough for anyone to guess why it's slow. Perhaps look at this:

     https://wiki.postgresql.org/wiki/Slow_Query_Questions

In particular, you'll have to tell us

(a) something about the hardware it's running on

(b) amounts of data in the tables / databases

(c) EXPLAIN or even better EXPLAIN ANALYZE of the query

(d) configuration of the database (work_mem, shared_buffers etc.)


regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (6+ messages)  latest in thread

Message-ID: <39b30cfde27a48898340a69940581727@cyient.com>
Permalink:  ../39b30cfde27a48898340a69940581727@cyient.com/
Also on:    postgresql.org/message-id/39b30cfde27a48898340a69940581727@cyient.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: Dinesh.Chandra@cyient.com, tomas.vondra@2ndquadrant.com
  Subject: Re: FW:  Re: Query is running very slow......
  In-Reply-To: <39b30cfde27a48898340a69940581727@cyient.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox