Fwd: views much slower in 9.3 than 8.4 - Mailing list pgsql-performance
From | Carson, Leonard |
---|---|
Subject | Fwd: views much slower in 9.3 than 8.4 |
Date | |
Msg-id | 9C8B9906-D76A-48EE-AED9-516AFD3A4725@ucsd.edu Whole thread Raw |
Responses |
Re: Fwd: views much slower in 9.3 than 8.4
(Tom Lane <tgl@sss.pgh.pa.us>)
|
List | pgsql-performance |
There is only one server at this point. The 8.4 machine was upgraded to 9.3 about a year ago and we have no 8.4 backups so it's difficult if not impossible to recreate the 8.4 environment AFAIK. One of our developers pointed out the discrepancy in execution times. I decomposed a slow view and found out that it consists of a view calling a view calling a view (3 deep). This is the analyze explain plan of the innermost view:And as you requested:SELECT version();Postgresql 9.3.4SELECT name, current_setting(name), source
FROM pg_settings
WHERE source NOT IN ('default', 'override');autovacuum,on,configuration filecheckpoint_completion_target,0.9,configuration filecheckpoint_segments,16,configuration fileclient_encoding,UTF8,sessionclient_min_messages,notice,configuration fileDateStyle,"ISO, MDY",configuration filedeadlock_timeout,5s,configuration filedefault_text_search_config,pg_catalog.english,configuration fileeffective_cache_size,8GB,configuration fileeffective_io_concurrency,6,configuration filelc_messages,en_US.UTF-8,configuration filelc_monetary,en_US.UTF-8,configuration filelc_numeric,en_US.UTF-8,configuration filelc_time,en_US.UTF-8,configuration filelisten_addresses,*,configuration filelog_checkpoints,on,configuration filelog_connections,on,configuration filelog_destination,stderr,configuration filelog_directory,/dbms/postgresql/logs/dtfdev,configuration filelog_disconnections,on,configuration filelog_duration,off,configuration filelog_error_verbosity,verbose,configuration filelog_filename,postgresql-%a.log,configuration filelog_hostname,on,configuration filelog_line_prefix,"%t [%p]: [%l-1] db=%d,user=%u ",configuration filelog_lock_waits,on,configuration filelog_min_duration_statement,0,configuration filelog_min_error_statement,error,configuration filelog_min_messages,warning,configuration filelog_rotation_age,1d,configuration filelog_rotation_size,500MB,configuration filelog_statement,none,configuration filelog_temp_files,0,configuration filelog_timezone,US/Pacific,configuration filelog_truncate_on_rotation,on,configuration filelogging_collector,on,configuration filemaintenance_work_mem,256MB,configuration filemax_connections,200,configuration filemax_stack_depth,8MB,configuration fileport,2222,configuration filerandom_page_cost,2,configuration filesearch_path,"acct, ""$user"", public",sessionshared_buffers,4GB,configuration filessl,on,configuration filetemp_buffers,16MB,configuration fileTimeZone,US/Pacific,configuration filewal_level,minimal,configuration filewal_sync_method,fdatasync,configuration filework_mem,5MB,configuration fileserver has 24GB of RAMfrom postgresql.conf:shared_buffers = 4GBeffective_cache_size = 8GBwork_mem = 5MB (note: I increased work_mem to 500MB and repeated the experiment, no difference in exec. time)On Mar 18, 2015, at 10:16 AM, Kevin Grittner <kgrittn@ymail.com> wrote:"Carson, Leonard" <lcarson@sdsc.edu> wrote:While acknowledging that nested loops and sequential table scans
account for 85% of the execution time which suggests that a
better query may be needed, why would the same query run in
seconds on 8.x but take minutes on 9.x?
First, please show the output of this from both servers:
SELECT version();
SELECT name, current_setting(name), source
FROM pg_settings
WHERE source NOT IN ('default', 'override');
Then, for your newer server, please follow the steps outlined here:
https://wiki.postgresql.org/wiki/SlowQueryQuestions
My first guess would be that at some point your costing parameters
were tuned on the old system, but have not yet been tuned on the
new one. Rather than blindly using the old settings for the new
server, it would be good to see the information requested on the
above-cited page to determine good settings for the new server.
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
pgsql-performance by date: