Re: [PERFORM] timestamp with time zone

2012-02-09 Thread Tom Lane
Alessandro Gagliardi writes: > Still slow as mud: http://explain.depesz.com/s/Zfn > Now I've got indices on created, timezone, created at time zone timezone, > and (created at time zone timezone)::date. Clearly the problem isn't a lack > of indices!...except, wait, it's not actually using blocks_c

Re: [PERFORM] random_page_cost = 2.0 on Heroku Postgres

2012-02-09 Thread Scott Marlowe
On Thu, Feb 9, 2012 at 3:41 PM, Peter van Hardenberg wrote: > Hmm, perhaps we could usefully aggregate auto_explain output. How about something where you run a site at random_page cost of x, then y, then z and you do some aggregating of query times in each. A scatter plot should tell you lots.

Re: [PERFORM] random_page_cost = 2.0 on Heroku Postgres

2012-02-09 Thread Peter van Hardenberg
Hmm, perhaps we could usefully aggregate auto_explain output. On Thu, Feb 9, 2012 at 7:32 AM, Jeff Janes wrote: > On Wed, Feb 8, 2012 at 6:28 PM, Scott Marlowe wrote: >> On Wed, Feb 8, 2012 at 6:45 PM, Peter van Hardenberg wrote: >>> Having read the thread, I don't really see how I could study

Re: [PERFORM] timestamp with time zone

2012-02-09 Thread Alessandro Gagliardi
Still slow as mud: http://explain.depesz.com/s/Zfn Now I've got indices on created, timezone, created at time zone timezone, and (created at time zone timezone)::date. Clearly the problem isn't a lack of indices!...except, wait, it's not actually using blocks_created_date_idx (or blocks_created_at

Re: [PERFORM] timestamp with time zone

2012-02-09 Thread Kevin Grittner
Alessandro Gagliardi wrote: > (Actually, I originally did try one on "(created at time zone > timezone)::date" but couldn't figure out how to phrase it in a way > PostgreSQL would accept.) CREATE INDEX blocks_created_date_idx ON blocks USING btree (((created at time zone timezone)::date)

Re: [PERFORM] timestamp with time zone

2012-02-09 Thread Alessandro Gagliardi
I tried: CREATE INDEX blocks_created_at_timezone_idx ON blocks USING btree ((created at time zone timezone)); (Actually, I originally did try one on "(created at time zone timezone)::date" but couldn't figure out how to phrase it in a way PostgreSQL would accept.) Anyway, no difference: http://ex

Re: [PERFORM] timestamp with time zone

2012-02-09 Thread Tom Lane
Alessandro Gagliardi writes: > WHERE ... (created at time zone timezone)::date = 'yesterday' > created has an index (btree if it matters). timezone does not. I'm > wondering if the solution to my problem is to create a joint index between > created and timezone (and if so, if there is a particula

[PERFORM] timestamp with time zone

2012-02-09 Thread Alessandro Gagliardi
Here's my query: SELECT foursquare.name, foursquare.city, COUNT(moment_id) AS popularity FROM foursq_categories JOIN foursquare USING (foursq_id) JOIN places USING (foursq_id) JOIN blocks USING (block_id) WHERE "primary" AND (created at time zone timezone)::date = 'yesterday' AND (country = 'U

Re: [PERFORM] random_page_cost = 2.0 on Heroku Postgres

2012-02-09 Thread Jeff Janes
On Wed, Feb 8, 2012 at 6:28 PM, Scott Marlowe wrote: > On Wed, Feb 8, 2012 at 6:45 PM, Peter van Hardenberg wrote: >> Having read the thread, I don't really see how I could study what a >> more principled value would be. > > Agreed.  Just pointing out more research needs to be done. > >> That sai

Re: [PERFORM] Inserts or Updates

2012-02-09 Thread Frank Lanitz
Am 07.02.2012 18:40, schrieb Ofer Israeli: > Table 1: > 46 columns > 23 indexes on fields of the following types: > INTEGER - 7 > TIMESTAMP - 2 > VARCHAR - 12 > UUID - 2 > > 23 columns > 12 indexes on fields of the following types: > INTEGER - 3 > TIMESTAMP - 1 > VARCHAR - 6 > UUID - 2 Are you re

Re: [PERFORM] Inserts or Updates

2012-02-09 Thread Vik Reykja
On Wed, Feb 8, 2012 at 20:22, Ofer Israeli wrote: > Andy Colson wrote: > > Oh, I knew I'd seen index usage stats someplace. > > > > give this a run: > > > > select * from pg_stat_user_indexes where relname = 'SuperBigTable'; > > > > http://www.postgresql.org/docs/current/static/monitoring-stats.h