New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for UNLOGGED Postgresql tables #34221

Merged
merged 1 commit into from Nov 13, 2018

Conversation

Projects
None yet
5 participants
@JacobEvelyn
Contributor

JacobEvelyn commented Oct 15, 2018

This commit adds support for the
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables
setting, which turns CREATE TABLE SQL statements into
CREATE UNLOGGED TABLE statements.

This can improve PostgreSQL performance but at the
cost of data durability, and thus it is highly recommended
that you DO NOT enable this in a production environment.

Summary

Created this PR as suggested in #34192. Details are in the commit message (see above).

Other Information

I'm not sure if the way I've written this or the way I've tested this follows the best practices of the Rails codebase. In particular I went back and forth on whether to expressly disallow this setting from being enabled when Rails.env.production? is true (or similarly, only allowing it when Rails.env.test? is true). I originally wrote the code that way but then couldn't find examples of any other settings that weren't overridable in a particular environment, so I removed it.

Feedback welcome!

@rails-bot

This comment has been minimized.

rails-bot commented Oct 15, 2018

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @kaspth (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@JacobEvelyn

This comment has been minimized.

Contributor

JacobEvelyn commented Oct 29, 2018

Hi @kaspth! Any updates on when I can expect to hear back about this? I don't want to nag but I have no idea what sort of turnaround time to expect. Thanks!

@JacobEvelyn

This comment has been minimized.

Contributor

JacobEvelyn commented Nov 7, 2018

Just another friendly ping, @kaspth! Let me know if there's anything I can do to speed this process up. Thanks!

Add support for UNLOGGED Postgresql tables
This commit adds support for the
`ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables`
setting, which turns `CREATE TABLE` SQL statements into
`CREATE UNLOGGED TABLE` statements.

This can improve PostgreSQL performance but at the
cost of data durability, and thus it is highly recommended
that you *DO NOT* enable this in a production environment.

@JacobEvelyn JacobEvelyn force-pushed the JacobEvelyn:allow-postgres-unlogged-test-tables branch from d189369 to bfc4d8b Nov 13, 2018

@JacobEvelyn

This comment has been minimized.

Contributor

JacobEvelyn commented Nov 13, 2018

@eileencodes sorry for the ping—any idea if there's anything I can do to get this reviewed more quickly? It's kind of a pain to keep updating my forked repo for merge conflicts.

@rafaelfranca rafaelfranca merged commit e1290a8 into rails:master Nov 13, 2018

2 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@JacobEvelyn JacobEvelyn deleted the JacobEvelyn:allow-postgres-unlogged-test-tables branch Nov 13, 2018

# :singleton-method:
# PostgreSQL allows the creation of "unlogged" tables, which do not record
# data in the PostgreSQL Write-Ahead Log. This can make the tables faster,
# bug significantly increases the risk of data loss if the database

This comment has been minimized.

@fschwahn

fschwahn Nov 16, 2018

Contributor

there's a typo here: bug should be but

This comment has been minimized.

@JacobEvelyn

JacobEvelyn Nov 16, 2018

Contributor

Yikes, good catch. What's the best way for me to fix this? Submit a new PR?

This comment has been minimized.

@rafaelfranca

This comment has been minimized.

@JacobEvelyn

JacobEvelyn Nov 16, 2018

Contributor

Thanks! Done: #34467

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment