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

Necessity of RETURNING * #201

Open
repomaa opened this issue Aug 27, 2018 · 3 comments
Open

Necessity of RETURNING * #201

repomaa opened this issue Aug 27, 2018 · 3 comments
Labels
discussion Community input needed

Comments

@repomaa
Copy link

repomaa commented Aug 27, 2018

The reason for RETURNING * on inserts and updates is probably for setting database-level column defaults to the model instance. I wonder if this is something that should be done by default. maybe an optional Query#returning method could be introduced which would allow setting this to field names like in Query#select.

@repomaa repomaa added the discussion Community input needed label Aug 27, 2018
@repomaa
Copy link
Author

repomaa commented Aug 27, 2018

Returning nothing or only the primary key value could be a real performance boost.

@repomaa
Copy link
Author

repomaa commented Aug 28, 2018

Same applies of course to other adapters that use SELECT with LAST_INSERTED_ID()

@fridgerator
Copy link
Member

I knew there would be a performance decrease (especially on mysql and sqlite) at the cost of having the newly inserted record id.

I think defaulting to not returning this and providing an option to include it makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Community input needed
Projects
None yet
Development

No branches or pull requests

2 participants