django-redshift-backend
django-redshift-backend copied to clipboard
should we disable server side cursor for redshift connection by default?
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
?
@shimizukawa What is the downside of having server-side cursors on Redshift? It has a serious advantage for large querysets on PostgreSQL.
@emyller Redshift documentation recommends against using sever side cursors. https://docs.aws.amazon.com/redshift/latest/dg/declare.html#declare-performance https://docs.aws.amazon.com/redshift/latest/dg/declare.html#declare-constraints
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
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?
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
.
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