I'm on a W7 32bit virtual machine with python 2.7 and SQL Server 2008 with 
local views referencing Linked Server where the real data resides.
My setup is 
Django (1.7.4)
django-pyodbc (0.2.6)
django-pyodbc-azure (1.2.3)  ------------not using this, it was a false 
start that did not pan out.
mysqlclient (1.3.4)
pip (1.5.6)
pymssql (2.1.1)
pyodbc (3.0.6)
requests (2.5.1)
setuptools (7.0)
I quit using pymssql because I could not get that to work with Django.

I created an ODBC link to my local DB and it works reasonably well until I 
try to do a join.
Using SQL Server management studio, the join takes about 2 seconds
Using Django and select_related() the join takes 1.5 minutes.

I'm just in the early stages of building my app and am developing simple 
test scripts to verify the data is as expected.  But I cannot work with 
this much delay and I'm no expert at how to tune this query.  An example is
    records = 
models.Admissions.objects.select_related().filter(dischargedatetime=None, 
datebedinactive=None)

class Residents(models.Model): #~2000 records
    entitysys = models.IntegerField(primary_key=True, 
db_column='EntitySys')  
    internalid = models.TextField(db_column='InternalID', blank=True)  
    externalid = models.TextField(db_column='ExternalID', blank=True)  
    lastname = models.TextField(db_column='LastName', blank=True)  
    firstname = models.TextField(db_column='FirstName', blank=True)  
...
class Admissions(models.Model):  #~300 records
    episodesys = models.IntegerField(primary_key=True,  
db_column='EpisodeSys')  
    resident = models.ForeignKey(Residents, db_column='ResidentSys', 
blank=True, null=True)  
    episodetype = models.CharField(db_column='EpisodeType', max_length=2, 
blank=True)  
...

This is a new project and so there is much less data entered than there 
will be once fully implemented.  Is there a way to improve the performance 
within the django model framework?


-- 
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 [email protected].
To post to this group, send email to [email protected].
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/50e17d3f-9af3-4f40-b579-00c2e58a64e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to