Skip to content
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

Allow option to force index scan #3

Open
bensheldon opened this issue Nov 29, 2018 · 0 comments
Open

Allow option to force index scan #3

bensheldon opened this issue Nov 29, 2018 · 0 comments

Comments

@bensheldon
Copy link

When querying on a table with a small number of records (like in development), the Postgres query-planner may ignore indexes in favor of sequential scans.

It would be beneficial to have an option to force Postgres to use indexes when performing the query to better simulate production behavior.

An example implementation is:

Wallet.where(base_currency: "USD").explain(analyze: true, indexscan: true)

would be equivalent to:

ActiveRecord::Base.connection.execute('SET enable_seqscan = OFF')
Wallet.where(base_currency: "USD").explain(analyze: true)
ActiveRecord::Base.connection.execute('SET enable_seqscan = ON')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant