Join of any db table with Q.add_to_query

2008-11-03 Thread Dima Dogadaylo

Before merging of queryset-refactor it was possible to join any table
with any ON clause to any queryset with help of Q.as_sql. For example,
please see this one:
http://www.djangosnippets.org/snippets/257/

Since Django 1.0 ORM looks like more complicated, Q.as_sql is
disappeared (but still mentioned in docs (http://
docs.djangoproject.com/en/dev/ref/models/fields/). As I see from code
Q.as_sql was replaced with Q.add_to_query(self, query, used_aliases)
but from current code it looks like new implementation does not allow
to use ON clause with more than 1 statements, for example:

FROM blog LEFT JOIN cron_stats AS stats ON
stats.content_type_id = 12 AND stats.object_id = blog.id

Is it any way to use old behavior of Q.as_sql with Django 1.0 and join
any table that I want to any queryset? In other words, is it possible
to make working QLeftOuterJoin from http://www.djangosnippets.org/snippets/257/?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Django ORM performance patch. Fixes #5420, #5768

2008-02-14 Thread Dima Dogadaylo

I made a patch for Django to add QuerySet.fields(*fields,
**related_fields) and make possible to load only some from master and
related models fields. It allows to tune various object list queries
when we need only limited subset of all fields, improve general
performance and decrease database load. As side effect of this patch
support of selecting fields from related models in QuerySet.values()
is implemented too. It was changed signature of this method from
values(*fields) to values(*fields, **related_fields) but the change is
backward compatible.

See more details at:
http://www.mysoftparade.com/blog/django_orm_performance_patch/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Performance of a django website

2007-12-25 Thread Dima Dogadaylo



On Dec 11, 8:37 pm, Richard Coleman <[EMAIL PROTECTED]>
wrote:
> 1. mod_python
> 2. apache 2.2.4
> 3. I'm using funkload and ab to measure the requests per second of one
> of the base pages within the dynamic part of the website
> 4. When I hit a static page in the same way (using ab), I get 6500
> requests per second.
> 5. This is without memcached, or any other caching.

Apache may cache static pages and serve it from memory, but Django
requests Apache passes to your server without caching. If you want to
achieve speed of static pages for you Django pages, try to use
WebAlchemy: http://www.mysoftparade.com/blog/webalchemy-django-apache/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



WebAlchemy accelerates Django in 100 times

2007-11-18 Thread Dima Dogadaylo

With WebAlchemy only pages involved in form processing are served
directly by Django, the rest of the pages most of the time are served
directly by Apache as static content with static content speed. In
other words for Django-powered site it's possible to achieve speed
about 2000 request/sec, against about 500 request/sec with memcached
and about 20 request/sec for "typical" (10 fast SQL queries) page
without caching at all. Actual performance results of course will vary
from server/application/configuration.

As it was said "there are only two hard things in Computer Science:
cache invalidation and naming things". WebAlchemy radically resolves
the problem of stalled resources in cache that is natural for any
caching layer based on memcached, squid or etc. With WebAlchemy pages
are never become staled.

The magic is done inside concept.webalchemy.core.WebAlchemyMiddleware:
http://www.mysoftparade.com/blog/webalchemy-django-apache/

--
Dima Dogadaylo,
http://www.mysoftparade.com/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: MOD_PYTHON ERROR

2007-11-15 Thread Dima Dogadaylo

pacman,

looks like you code imported in settings.py conflicts with updated
django code. Execute ./manage.py validate or ./manage.py test to find
the problem file.

-- 
Dima Dogadaylo,
http://www.mysoftparade.com/

On Wed, 2007-11-14 at 19:46 -0800, pacman wrote:
> Hello all,
> I'm not for sure what this error is all about. I had django up and
> running with out flaw for quite a while but last night I decided to
> svn update my django source and that's when it seemed to flip out
> giving me this error message. Also I have have a script that I run
> from time to time that removes pyc file so I don't know if there is
> some sort of conflict there assuming not.
> 
> Currently I am using ubuntu 7.10 with apache/django/postgres and
> python 2.5.1
> 



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: How put admin in deployment

2007-11-13 Thread Dima Dogadaylo

On Tue, 2007-11-13 at 14:56 +, mamcxyz wrote:
> In test mode, I can acces the "admin" site, but when I deploy the site
> I can't do it.
> 
> Before, I setup another fastcgi process to it, but I think that is
> overkill (I must run this under a VPS). Any trick to put admin under
> the regular fastcgi process?

I run my blog under fastcgi on dreamhost with admin without any special
tricks. Why  can't you access /admin/? What is the error?

-- 
http://www.mysoftparade.com/


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Django profiler to find a project weak spots

2007-11-12 Thread Dima Dogadaylo

Hi,

I wrote a Django pofiler that can be used to find weak performance
spots in Django projects, i.e.  to find how many SQL-queries are used
per page, how heavy html-pages are, etc.

The source code of the script and examples of usage are available
here:
http://www.mysoftparade.com/blog/django-profile-sql-performance/

I wrote it because realised that sometimes it's easy to eventually
miss select_related() for an QuerySet and end with dozens of SQL
queries per page.

--
http://www.mysoftparade.com/


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Django profiler to find a project weak spots

2007-11-12 Thread Dima Dogadaylo

Hi,

I wrote a Django pofiler that can be used to find weak performance spots in 
Django projects, i.e.  to find how many SQL-queries are used per page, how 
heavy html-pages are, etc.

The source code of the script and examples of usage are available here:
http://www.mysoftparade.com/blog/django-profile-sql-performance/

I wrote it because realised that sometimes it's easy to eventually miss
select_related() for an QuerySet and end with dozens of SQL queries per
page.

-- 
http://www.mysoftparade.com/


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---