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

should we disable server side cursor for redshift connection by default? #22

Open
shimizukawa opened this issue Jun 30, 2017 · 6 comments

Comments

@shimizukawa
Copy link
Member

PostgreSQL driver use server side cursor by default since django-1.11.
https://docs.djangoproject.com/en/1.11/ref/databases/#server-side-cursors

Should we set DISABLE_SERVER_SIDE_CURSORS = True ?

@emyller
Copy link
Collaborator

emyller commented Aug 27, 2017

@shimizukawa What is the downside of having server-side cursors on Redshift? It has a serious advantage for large querysets on PostgreSQL.

@Cerebro92
Copy link

Cerebro92 commented Oct 10, 2018

@techbrownbags
Copy link

For what it's worth, not really sure....

I just started working on a dashboard for a redshift project and am prototyping with rails and django. The DISABLE_SERVER_SIDE_CURSORS = True setting got me past a “cursor ”django_curs*" does not exist” error.

I was getting that error on a ForeignKey association in admin and in a filtered list view I was building

@techbrownbags
Copy link

me again, even with DISABLE_SERVER_SIDE_CURSORS = True i'm seeing the exception in django_admin for a model with a site = models.ForeignKey(Site..) when navigating to the edit page.

I am setting the PK and FK in the redshift schema for documentation and query optimization.

Is anyone else seeing this?

@piranhaphish
Copy link

I just ran into this issue which setting DISABLE_SERVER_SIDE_CURSORS = True resolved:

I received the following error when rendering a bound form (i.e. re-displaying a populated form) that had a ModelMultipleChoiceField pointing to a model utilizing Redshift (note that an unbound, blank form rendered with no issue):

cursors can only be used within the transaction that created them

Strangely, googling that quoted phrase returns no results which made troubleshooting difficult. This error is thrown during the handling of the above exception while trying to close the cursor:

OperationalError: cursor "_django_curs_140089065723648_1" does not exist

I'm not using the admin for any of my models in Redshift, but I tried registering and testing one and it seemed to work okay regardless of the setting of DISABLE_SERVER_SIDE_CURSORS.

@techbrownbags
Copy link

DISABLE_SERVER_SIDE_CURSORS does work, as you know. I started having the issues when I added another db connection and had to move that setting to the specific redshift connection. Thanks

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

5 participants