Re: sequential scan result order vs performance - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: sequential scan result order vs performance
Date
Msg-id dac9b505-56d2-c852-805b-e1c902de113e@BlueTreble.com
Whole thread Raw
In response to Re: sequential scan result order vs performance  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: sequential scan result order vs performance  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Re: sequential scan result order vs performance  (ilmari@ilmari.org (Dagfinn Ilmari Mannsåker))
Re: sequential scan result order vs performance  (Corey Huinker <corey.huinker@gmail.com>)
List pgsql-hackers
On 10/30/16 9:12 AM, Tom Lane wrote:
> I think there will be a lot of howls.  People expect that creating
> a table by inserting a bunch of rows, and then reading back those
> rows, will not change the order.  We already futzed with that guarantee
> a bit with syncscans, but that only affects quite large tables --- and
> even there, we were forced to provide a way to turn it off.

Leaving a 30% performance improvement on the floor because some people 
don't grok how sets work seems insane to me.

We could have a GUC to disable this. I suspect ORDER BY ctid would be 
another option.

BTW, I've sometimes wished for a mode where queries would silently have 
result ordering intentionally futzed, to eliminate any possibility of 
dependence on tuple ordering (as well as having sequences start at some 
random value). I guess with the hooks that are in place today it 
wouldn't be hard to stick a ORDER BY random() in if there wasn't already 
a Sort node at the top level...
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)   mobile: 512-569-9461



pgsql-hackers by date:

Previous
From: "Karl O. Pinc"
Date:
Subject: Re: Patch to implement pg_current_logfile() function
Next
From: Jim Nasby
Date:
Subject: Re: Speed up Clog Access by increasing CLOG buffers