Re: [GENERAL] tablesample performance

2016-10-18 Thread Simon Riggs
On 18 October 2016 at 22:06, Tom Lane wrote: > Simon Riggs writes: >> On 18 October 2016 at 19:34, Tom Lane wrote: >>> If you don't want to have an implicit bias towards earlier blocks, >>> I don't think that either standard tablesample method is really what >>> you want. >>> >>> The contrib/tsm

Re: [GENERAL] tablesample performance

2016-10-18 Thread Tom Lane
Simon Riggs writes: > On 18 October 2016 at 19:34, Tom Lane wrote: >> If you don't want to have an implicit bias towards earlier blocks, >> I don't think that either standard tablesample method is really what >> you want. >> >> The contrib/tsm_system_rows tablesample method is a lot closer, in >

Re: [GENERAL] tablesample performance

2016-10-18 Thread Simon Riggs
On 18 October 2016 at 19:34, Tom Lane wrote: > Andy Colson writes: >> On 10/18/2016 11:44 AM, Francisco Olarte wrote: >>> This should be faster, but to me it seems it does a different thing. > >> Ah, yes, you're right, there is a bit of a difference there. > > If you don't want to have an implici

Re: [GENERAL] tablesample performance

2016-10-18 Thread Francisco Olarte
Andy: On Tue, Oct 18, 2016 at 7:17 PM, Andy Colson wrote: > Ah, yes, you're right, there is a bit of a difference there. > > Speed wise: > 1) select one from ones order by random() limit 1; >> about 360ms > 2) select one from ones tablesample bernoulli(1) limit 1 ; >> about 4ms > 3) select one fr

Re: [GENERAL] tablesample performance

2016-10-18 Thread Tom Lane
Andy Colson writes: > On 10/18/2016 11:44 AM, Francisco Olarte wrote: >> This should be faster, but to me it seems it does a different thing. > Ah, yes, you're right, there is a bit of a difference there. If you don't want to have an implicit bias towards earlier blocks, I don't think that eithe

Re: [GENERAL] tablesample performance

2016-10-18 Thread Andy Colson
On 10/18/2016 11:44 AM, Francisco Olarte wrote: On Tue, Oct 18, 2016 at 5:06 PM, Andy Colson wrote: I wanted to report an awesome performance boost using tablesample. In my stored function I was getting a random row using: select one into x from ones order by random() limit 1; When the table wa

Re: [GENERAL] tablesample performance

2016-10-18 Thread Francisco Olarte
On Tue, Oct 18, 2016 at 5:06 PM, Andy Colson wrote: > I wanted to report an awesome performance boost using tablesample. > In my stored function I was getting a random row using: > select one into x from ones order by random() limit 1; > When the table was smaller it worked fine, but the performan

[GENERAL] tablesample performance

2016-10-18 Thread Andy Colson
I wanted to report an awesome performance boost using tablesample. In my stored function I was getting a random row using: select one into x from ones order by random() limit 1; When the table was smaller it worked fine, but the performance has slowly gotten worse. This morning I was getting a