Re: [PERFORM] Query tuning: partitioning, DISTINCT ON, and indexing

2013-06-20 Thread Maciek Sakrejda
On Thu, Jun 20, 2013 at 9:13 PM, bricklen wrote: > > On Thu, Jun 20, 2013 at 6:24 PM, Maciek Sakrejda wrote: > >> SELECT >> DISTINCT ON (type) ts, type, details >> FROM >> observations >> WHERE >> subject = '...' >> ORDER BY >> type, ts DESC; >> > > First thing: What is your "work_mem" se

Re: [PERFORM] Query tuning: partitioning, DISTINCT ON, and indexing

2013-06-20 Thread bricklen
On Thu, Jun 20, 2013 at 6:24 PM, Maciek Sakrejda wrote: > SELECT > DISTINCT ON (type) ts, type, details > FROM > observations > WHERE > subject = '...' > ORDER BY > type, ts DESC; > First thing: What is your "work_mem" set to, and how much RAM is in the machine? If you look at the plan, y

[PERFORM] Query tuning: partitioning, DISTINCT ON, and indexing

2013-06-20 Thread Maciek Sakrejda
I'm trying to optimize a query on a partitioned table. The schema looks like this: CREATE TABLE observations( ts timestamptz NOT NULL DEFAULT now(), type text NOT NULL, subject uuid NOT NULL, details json NOT NULL ); The table is partitioned by ts (right now I have ~300 1h partitions, whi

Re: [PERFORM] PostgreSQL settings for running on an SSD drive

2013-06-20 Thread Andrew Dunstan
On 06/20/2013 05:23 PM, Shaun Thomas wrote: On 06/20/2013 03:32 PM, Josh Berkus wrote: Did you compare setting RPC to 1.0 vs. setting it to 1.1, or something else just slightly higher than SPC? Yes, actually. My favored setting when we were on 8.3 was 1.5. But something with the planner cha

Re: [PERFORM] PostgreSQL settings for running on an SSD drive

2013-06-20 Thread Shaun Thomas
On 06/20/2013 03:32 PM, Josh Berkus wrote: Did you compare setting RPC to 1.0 vs. setting it to 1.1, or something else just slightly higher than SPC? Yes, actually. My favored setting when we were on 8.3 was 1.5. But something with the planner changed pretty drastically when we went to 9.1,

Re: [PERFORM] PostgreSQL settings for running on an SSD drive

2013-06-20 Thread Josh Berkus
Folks, First, cc'ing Greg Smith to see if he can address this with the Fusion folks so that they stop giving out a bad guide. On 06/20/2013 01:13 PM, Shaun Thomas wrote: > On 06/20/2013 02:56 PM, CS DBA wrote: > >> They have a PostgreSQL setup guide from Fusion recommending the >> following sett

Re: [PERFORM] PostgreSQL settings for running on an SSD drive

2013-06-20 Thread Shaun Thomas
On 06/20/2013 02:56 PM, CS DBA wrote: They have a PostgreSQL setup guide from Fusion recommending the following settings: effective_io_concurrency=0 bgwriter_lru_maxpages=0 random_page_cost=0.1 sequential_page_cost=0.1
 Well, since FusionIO drives have a limited write cycle (5PB?), I can some

[PERFORM] PostgreSQL settings for running on an SSD drive

2013-06-20 Thread CS DBA
All; I'm working with a client running PostgreSQL on a Fusion-IO drive. They have a PostgreSQL setup guide from Fusion recommending the following settings: effective_io_concurrency=0 bgwriter_lru_maxpages=0 random_page_cost=0.1 sequential_page_cost=0.1
 These seem odd to me, effectively turni