Re: UPDATEDs slowing SELECTs in a fully cached database
От | lars |
---|---|
Тема | Re: UPDATEDs slowing SELECTs in a fully cached database |
Дата | |
Msg-id | 4E1CA8E9.6090108@yahoo.com обсуждение исходный текст |
Ответ на | Re: UPDATEDs slowing SELECTs in a fully cached database ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>) |
Ответы |
Re: UPDATEDs slowing SELECTs in a fully cached
database
Re: UPDATEDs slowing SELECTs in a fully cached database Re: UPDATEDs slowing SELECTs in a fully cached database |
Список | pgsql-performance |
On 07/12/2011 12:08 PM, Kevin Grittner wrote: > lars<lhofhansl@yahoo.com> wrote: > >> select count(*) from test where tenant = $1 and created_date = $2 > > Ah, that might be a major clue -- prepared statements. > > What sort of a plan do you get for that as a prepared statement? > (Note, it is very likely *not* to be the same plan as you get if you > run with literal values!) It is not at all unlikely that it could > resort to a table scan if you have one tenant which is five or ten > percent of the table, which would likely trigger the pruning as it > passed over the modified pages. > > -Kevin So a read of a row *will* trigger dead tuple pruning, and that requires WAL logging, and this is known/expected? This is actually the only answer I am looking for. :) I have not seen this documented anywhere. I know that Postgres will generate general plans for prepared statements (how could it do otherwise?), I also know that it sometimes chooses a sequential scan. This can always be tweaked to touch fewer rows and/or use a different plan. That's not my objective, though! The fact that a select (maybe a big analytical query we'll run) touching many rows will update the WAL and wait (apparently) for that IO to complete is making a fully cached database far less useful. I just artificially created this scenario. ... Just dropped the table to test something so I can't get the plan right now. Will send an update as soon as I get it setup again. Thanks again. -- Lars
В списке pgsql-performance по дате отправления: