From nobody Wed May 8 04:34:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1540996813540350.2946507710192; Wed, 31 Oct 2018 07:40:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2390488E57; Wed, 31 Oct 2018 14:40:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 10D0161080; Wed, 31 Oct 2018 14:40:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EFEB54BB74; Wed, 31 Oct 2018 14:40:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9VEeAfE000624 for ; Wed, 31 Oct 2018 10:40:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 351BE26361; Wed, 31 Oct 2018 14:40:10 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-62.ams2.redhat.com [10.36.112.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED5EE26367 for ; Wed, 31 Oct 2018 14:40:06 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Wed, 31 Oct 2018 15:40:05 +0100 Message-Id: <20181031144005.5699-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] add more indices to Message X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 31 Oct 2018 14:40:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Add indices to help the series list page. The project is almost always used as a search key, either directly or through a parent project, so include both a variant with the project and one without. The sorting keys are left last, while filter keys should come first. This reduces the SELECT COUNT(*) query in the series list from 180 ms to 5 ms on a full dump from a few weeks ago. Signed-off-by: Paolo Bonzini --- api/migrations/0037_auto_20181031_1439.py | 19 +++++++++++++++++++ api/models.py | 4 ++++ 2 files changed, 23 insertions(+) create mode 100644 api/migrations/0037_auto_20181031_1439.py diff --git a/api/migrations/0037_auto_20181031_1439.py b/api/migrations/003= 7_auto_20181031_1439.py new file mode 100644 index 0000000..ca75e37 --- /dev/null +++ b/api/migrations/0037_auto_20181031_1439.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.15 on 2018-10-31 14:39 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies =3D [ + ('api', '0036_populate_message_tags'), + ] + + operations =3D [ + migrations.AlterIndexTogether( + name=3D'message', + index_together=3Dset([('is_series_head', 'project', 'date'), (= 'is_series_head', 'date'), ('is_series_head', 'last_reply_date'), ('is_seri= es_head', 'project', 'last_reply_date')]), + ), + ] diff --git a/api/models.py b/api/models.py index ab0bd06..09758f6 100644 --- a/api/models.py +++ b/api/models.py @@ -714,6 +714,10 @@ class Message(models.Model): =20 class Meta: unique_together =3D ('project', 'message_id',) + index_together =3D [('is_series_head', 'project', 'last_reply_date= '), + ('is_series_head', 'project', 'date'), + ('is_series_head', 'last_reply_date'), + ('is_series_head', 'date')] =20 class MessageResult(Result): message =3D models.ForeignKey(Message, related_name=3D'results') --=20 2.17.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel