On 21 Mai, 15:50, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Fri, May 16, 2008 at 9:27 PM, Adrian R. <[EMAIL PROTECTED]> wrote: > > > Okay, so I've got some additional information for you which are > > hopefully useful for you. I've tried to switch to the dev version but > > I don't think that I'm on the right way right now. > > I don't mean to be rude, but this isn't particularly helpful. A > pageful of SQL doesn't really help me determine the problem you are > having, or how a 'Raw SQL model' will solve the problem. > > Can you reduce your problem to a simple (or, at least, simplified) case?
I think that there isn't much more to explain, because today we decided to switch to PostgreSQL which solved the problem in first tests and hopefully keeps this good performance in other tests. But if you still want to know what I tried to explain in my last six messages: Accessing the database-view using a WHERE-condition is as slow as without and it takes 350 times more time to generate results instead of using the SQL which generated the view and put a WHERE-condition directly into it. Optimizing the view didn't solve the problem. The problem isn't the query (because with WHERE-conditions or a LIMIT it performed very well - and it was the usual case to use conditions or limits) but the view which was with and without conditions equally slow. So I decided to use Django: I couldn't generate the query using Django's ORM. So tried to put the SQL directly into Django without using the db.cursor() which wouldn't solve my problem because i couldn't use extra() anymore. It didn't work because of table-aliases I think, but I didn't do any further testing. But I'd recommend to extend the extra(tables=...)-method to accept own aliases for tables. Oh, I think at least this all wasn't really my problem. The problem is the way how the MySQL-guys have implemented views (http:// bugs.mysql.com/bug.php?id=23136). My attempt was just a workaround to solve this... So the idea behind my question was to implement some sort of database- view in django, so that you just take the sql which would create the view and put it into a model. Why? Because MySQL doesn't handle some views very well and maybe other DBMS also don't and you could make new models which could just join and aggregate data from other tables or... I don't know. hope that this isn't my problem anymore.. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers?hl=en -~----------~----~----~----~------~----~------~--~---