On 8/27/07, Kugutsumen <[EMAIL PROTECTED]> wrote:
>
> Why is my select is 2 times faster than objects.get(name=domain)?
>
> Why is there so much  overhead?

Have a look at the code.  :)

> d = Domain.objects.get(name=domain) [...]
> Checked 90000 domains at 1434 domain/s
>
> Now if instead I just do:
>
> cursor.execute("""SELECT id,name from "DNS_domain" WHERE name='%s'
> """
> % domain)
> row = cursor.fetchone()
>
> Checked 90000 domains at 3659 domain/s

If you're going to select 90,000 domains, is there no way you can batch it?

Or, is there no way you can cache them?

> I am using django latest trunk and postgresql 8.2
> The domain relation contains 180 million records.


Do they change often?  Often relative to select?

> class Domain(models.Model):
>     name = models.CharField("domain name", maxlength=255,
> unique=True)
...

Consider making name the primary key rather than letting AutoField do
it.  This removes a bit of overhead in Django, but also provides
clustered lookup, assuming this is a lookup that you really need to be
fast...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to