Thanks John, I am going to try that. That's what I was looking for.
And to answer Jeremy, I don't understand why would I want to have name
as a primary key. The surrogate autofield primary key does a much
better job being referenced as a foreign key all over the place.
Using adaptive-readahead by Wu Fengguang gave about 30% increase in
performance.
I'll probably have that particular relation (table) which is central
to my project in ram in a patricia or judy tree. I wish postgresql
would support patricia tries, there is a research project (not public)
at purdue called SP-GiST which should enable patricia indexes.
On Aug 27, 10:19 pm, John Melesky <[EMAIL PROTECTED]> wrote:
> On Aug 27, 2007, at 2:05 AM, Kugutsumen wrote:
>
> > cursor.execute("""SELECT id,name from "DNS_domain" WHERE name='%s'
> > """
> > % domain)
> > row = cursor.fetchone()
>
> If you do just need those two fields, and no object methods, you can
> use the "values" queryset method. Something like:
>
> d = Domain.objects.filter(name=domain).values('id', 'name')[0]
>
> from:http://www.djangoproject.com/documentation/db-api/#values-fields
>
> That will still likely be slightly slower than a direct sql call, but
> should speed things up by eliminating the object creation.
>
> -johnnnnnn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---