Re: [PERFORM] Query performance

2015-01-24 Thread Joe Van Dyk
On Sat, Jan 24, 2015 at 11:14 PM, Pavel Stehule wrote: > > > 2015-01-25 7:38 GMT+01:00 Joe Van Dyk : > >> >> >> On Sat, Jan 24, 2015 at 10:12 PM, Pavel Stehule >> wrote: >> >>> Hi >>> >>> this plan looks well >>> >>> Regards >>> >>> Pavel >>> >> >> Here's one that's not quite as well: http://exp

Re: [PERFORM] Query performance

2015-01-24 Thread Pavel Stehule
2015-01-25 7:38 GMT+01:00 Joe Van Dyk : > > > On Sat, Jan 24, 2015 at 10:12 PM, Pavel Stehule > wrote: > >> Hi >> >> this plan looks well >> >> Regards >> >> Pavel >> > > Here's one that's not quite as well: http://explain.depesz.com/s/SgT > I see a possible issue (product_id <> '81716'::citext

Re: [PERFORM] Query performance

2015-01-24 Thread Joe Van Dyk
On Sat, Jan 24, 2015 at 10:12 PM, Pavel Stehule wrote: > Hi > > this plan looks well > > Regards > > Pavel > Here's one that's not quite as well: http://explain.depesz.com/s/SgT Joe > > 2015-01-25 6:45 GMT+01:00 Joe Van Dyk : > >> Oops, didn't run vacuum analyze after deleting the events. Her

Re: [PERFORM] Query performance

2015-01-24 Thread Pavel Stehule
Hi this plan looks well Regards Pavel 2015-01-25 6:45 GMT+01:00 Joe Van Dyk : > Oops, didn't run vacuum analyze after deleting the events. Here is another > 'explain analyze': http://explain.depesz.com/s/AviN > > On Sat, Jan 24, 2015 at 9:43 PM, Joe Van Dyk wrote: > >> On Sat, Jan 24, 2015 at

Re: [PERFORM] Query performance

2015-01-24 Thread Joe Van Dyk
Oops, didn't run vacuum analyze after deleting the events. Here is another 'explain analyze': http://explain.depesz.com/s/AviN On Sat, Jan 24, 2015 at 9:43 PM, Joe Van Dyk wrote: > On Sat, Jan 24, 2015 at 9:41 PM, Joe Van Dyk wrote: > >> I have an events table that records page views and purcha

Re: [PERFORM] Query performance

2015-01-24 Thread Joe Van Dyk
On Sat, Jan 24, 2015 at 9:41 PM, Joe Van Dyk wrote: > I have an events table that records page views and purchases (type = > 'viewed' or type='purchased'). I have a query that figures out "people who > bought/viewed this also bought/viewed that". > > It worked fine, taking about 0.1 seconds to co

[PERFORM] Query performance

2015-01-24 Thread Joe Van Dyk
I have an events table that records page views and purchases (type = 'viewed' or type='purchased'). I have a query that figures out "people who bought/viewed this also bought/viewed that". It worked fine, taking about 0.1 seconds to complete, until a few hours ago when it started taking hours to c

Re: [PERFORM] How to tell ANALYZE to collect statistics from the whole table?

2015-01-24 Thread Tom Lane
AlexK987 writes: > The documentation states that "The extent of analysis can be controlled by > adjusting the default_statistics_target configuration variable". It looks > like I can tell Postgres to create more histograms with more bins, and more > distinct values. This implicitly means that Post

Re: [PERFORM] Initial insert

2015-01-24 Thread Tomas Vondra
Hi, On 22.1.2015 17:46, Laurent Cathala wrote: > Hi, > I'm trying to create datas on an initial import and i'm encountering a > performance issue. > I've 2 tables, my process create a record in each table and execute a > sum with join on this 2 tables. (and other requests but there are very fast)

Re: [PERFORM] How to tell ANALYZE to collect statistics from the whole table?

2015-01-24 Thread Tomas Vondra
On 25.1.2015 02:04, AlexK987 wrote: > Tomas, > > Thank you for a very useful reply. Right now I do not have a case of > poor performance caused by strong data skew which is not properly > reflected in statistics. I was being defensive, trying to prevent > every possible thing that might go wrong.

Re: [PERFORM] How to tell ANALYZE to collect statistics from the whole table?

2015-01-24 Thread AlexK987
Tomas, Thank you for a very useful reply. Right now I do not have a case of poor performance caused by strong data skew which is not properly reflected in statistics. I was being defensive, trying to prevent every possible thing that might go wrong. -- View this message in context: http://post

Re: [PERFORM] How to tell ANALYZE to collect statistics from the whole table?

2015-01-24 Thread Tomas Vondra
Hi, On 25.1.2015 00:33, AlexK987 wrote: > The documentation states that "The extent of analysis can be > controlled by adjusting the default_statistics_target configuration > variable". It looks like I can tell Postgres to create more > histograms with more bins, and more distinct values. This

[PERFORM] How to tell ANALYZE to collect statistics from the whole table?

2015-01-24 Thread AlexK987
The documentation states that "The extent of analysis can be controlled by adjusting the default_statistics_target configuration variable". It looks like I can tell Postgres to create more histograms with more bins, and more distinct values. This implicitly means that Postgres will use a larger ran