tablesample performance

From: Andy Colson <andy(at)squeakycode(dot)net>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: tablesample performance
Date: 2016-10-18 15:06:51
Message-ID: c87b5d82-fcca-7308-95ea-6c04a55c6867@squeakycode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 around 8 transactions a
second.

I just replaced it with:
select one into x from ones tablesample bernoulli(1) limit 1;

And now I'm getting 376 transactions a second!

Thank you dev's! Thank you PG 9.5!

-Andy

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2016-10-18 15:47:15 Re: Generic way to test input arguments
Previous Message oyoun 2016-10-18 15:01:27 Re: Generic way to test input arguments