Hi,

1.5b rows is rather big data.

Could you test what .values() or .values_list() produces in terms of speed.

also print qs might actually pull in all selected records in Python memory so 
it may take a while to constuct bunch of objects.


On Thu, 22 Jan 2015 07:32:36 -0800 (PST)
Joris Benschop <joris.bensc...@gmail.com> wrote:

> Dear List,
> 
> I'm trying to run a simple select on a very large Oracle table (1500 
> million records). 
> 
> I create a standard django model:
> ------------------
> class Marker(models.Model):
>     marker_id = SYSGUID16Field(primary_key=True)  # This field type is a 
> guess.
>     markid = models.CharField(unique=True, max_length=20, blank=True)
>     crop = models.ForeignKey("variantdb_admin.Crop", blank=True, null=True)
>     insid = models.CharField(max_length=5, blank=True)
>     insdate = models.DateTimeField(blank=True, null=True)
> 
>     class Meta:
>         managed = False
>         db_table = "prod_schema"."marker"
> ------------------
> 
> then simply run:
> >>> x = Marker.objects.filter(markid = 'TO11')
> >>> print x
> 
> in debugger, this basically creates the following simple query:
> DEBUG (44.120) QUERY = u'SELECT "PROD_SCHEMA"."MARKER"."MARKER_ID", 
> "PROD_SCHEMA"."MARKER"."MARKID", "PROD_SCHEMA"."MARKER"."CROP_ID", 
> "PROD_SCHEMA"."MARKER"."INSID", "PROD_SCHEMA"."MARKER"."INSDATE" FROM 
> "PROD_SCHEMA"."MARKER" WHERE "PROD_SCHEMA"."MARKER"."MARKID" = :arg0' - 
> PARAMS = (u'TO11',); args=('TO11',)
> 
> As you see, in Django this takes 44 seconds to run. 
> If I run this exact same query with cx_oracle directly the response time = 
> < 0.1sec.
> 
> For small tables the performance of django is quite good, so it almost 
> seems like django tries to do a count on the table before runnign the query 
> or something. Any suggestions on how I can make this lookup faster?
> 
> thanks
> joris
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/7db20206-9af7-491f-a0ed-b84f43cd4096%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150123082311.4729cd3d%40jns42-l.w2k.keypro.fi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to