CodeScaleInc/log4django — pull request #16 by yetty (2014-09-09 14:21:03+00:00)
Title: Allow LogRecord.app nullable

If ``LogRecord.app`` has null set to false, Django generates query like this:

```
SELECT
`log4django_logrecord`.`id`, `log4django_logrecord`.`app_id`, `log4django_logrecord`.`loggerName`,
`log4django_logrecord`.`level`, `log4django_logrecord`.`timestamp`, `log4django_logrecord`.`message`,
`log4django_logrecord`.`fileName`, `log4django_logrecord`.`lineNumber`, `log4django_logrecord`.`thread`,
`log4django_logrecord`.`exception_message`, `log4django_logrecord`.`exception_traceback`, `log4django_logrecord`.`request_id`,
`log4django_logrecord`.`_extra`, `log4django_app`.`id`, `log4django_app`.`key`, `log4django_app`.`name`, `log4django_app`.`description`
FROM `log4django_logrecord`
INNER JOIN `log4django_app` ON ( `log4django_logrecord`.`app_id` = `log4django_app`.`id` )
ORDER BY `log4django_logrecord`.`id` DESC
LIMIT 100 OFFSET 2600;
```

which is really slow for bigger count of rows. If null is set to true, `INNER` is changed to `LEFT` join.