From nobody Sun Dec 22 06:06:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=patchew-devel-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1663592450; cv=none; d=zohomail.com; s=zohoarc; b=Ds61PH+5ygq/TxjgbzJCtzs5DvURuV2UWKjwiURR9NFlZEIY35s1Dw22D6RtJJ9t2Brvc5UrEqiYCBQcxeGKqXrvoZxNtPDR8Xdn5oLAeVPUkpbfvfuJFZXXcrzY5jE7irUdfNgUQv1EHOLVkdRttiOVGp328wy6LOSDpK0cti0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663592450; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=ZCTMZU4PC7GvtDtzPOpedCm1qgVOysmeTJIcFZhH9z0=; b=CcGHzveN3ih9URLJQ7ORN7oSnl4knUMKkSp7yl8w8KbGruERkJWVV7C6LutmQJqS1OVTTETLl/KHcGOsT6mrawUKODZ8w147Q3B+Var8HG/toaV65KteEbLFpituq49/3ukNbI4/VK6CEgmNtpi/HaeMQfbW/SS+RJkK+SHRltA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1663592450722158.7722716127572; Mon, 19 Sep 2022 06:00:50 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-302-mNfELHSWNu6oHrXlTh6VQA-1; Mon, 19 Sep 2022 09:00:46 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 44AD029AB459; Mon, 19 Sep 2022 13:00:46 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D377492CA2; Mon, 19 Sep 2022 13:00:46 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0216C1946594; Mon, 19 Sep 2022 13:00:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 83BE71946586 for ; Mon, 19 Sep 2022 13:00:44 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 742EB140EBF5; Mon, 19 Sep 2022 13:00:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6CC9D140EBF3 for ; Mon, 19 Sep 2022 13:00:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 51E3581B539 for ; Mon, 19 Sep 2022 13:00:44 +0000 (UTC) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-482-hsxUxixmPUu6ar8qV0wMTg-1; Mon, 19 Sep 2022 09:00:34 -0400 Received: by mail-wr1-f70.google.com with SMTP id d25-20020adf9b99000000b0022adb03aee6so1716676wrc.6 for ; Mon, 19 Sep 2022 06:00:34 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id z16-20020a05600c221000b003b3401f1e24sm13335410wml.28.2022.09.19.06.00.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 06:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663592449; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ZCTMZU4PC7GvtDtzPOpedCm1qgVOysmeTJIcFZhH9z0=; b=CGS3/SwGEVYJCrjzD3QS4bdOrhtRqFQAIqc9t2rJ1dBizKrI1ygtgLB1+1hzVvf4dJt8+8 B50zHnN5tfYKOI8PO3L4jDuBasuaW7xyOvsR/Fj6G3GPrLFYGkoQZiOEIZuiAH8MCGhVgf q+RfrPQmTFXW0wBt/OFwsWGiSIIwNVc= X-MC-Unique: mNfELHSWNu6oHrXlTh6VQA-1 X-Original-To: patchew-devel@listman.corp.redhat.com X-MC-Unique: hsxUxixmPUu6ar8qV0wMTg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date; bh=dIPItetOU2GRvXNhvPJI9nvUuz8A6U0toXmjtSroyfI=; b=LYqB+RoSH6TGx/XG3FwQ6WXMEv9tn1JIkjMYPVnTuqtxMMqPYIdcisHn/g0w8St5cs ljqo/KAEyFDTRpk9w6d4JdIl3wgETEh9TEJMNal8SJymTwj/6lbZU7g186kGj+K24PlF hHI4DU3TOPex3ZlC45MIV3KvsJuPrN+fmfeLizG7GZMb44j6TCAhTNcUZ/N4WhFmxZa1 PnqeyrQsg6h69UnlpFT5Q313r6saMnCIPcYGsV49BTNHe86HtIGW5caCdTEJhoEVSlL3 Vzi3T0w8HR+l+BwFwinkIlukLFtB25sxkcWCz9HNMdtP3e3zVTQe6LnKJffAj3Qc7yCb XgKg== X-Gm-Message-State: ACrzQf3E93U0M4uCfIPtZB69hhnNfdQQQo1ome6IChcs+Wlsy4kEYqQf xDoVPd7DmwsTz34285qAHcRIR5wojQmZxkVyivkqHTaWzuj6GARpAtnOaOLFOne/tZvGIp7GlJI RYv9FVmTbYwjQhjgY36v3CesTi3kC9LS3mHUSwLemtMtLRlc1DgDmrkZIf/J2/fBkfppOM36VVg == X-Received: by 2002:a05:6000:1081:b0:22a:2ecf:9cf8 with SMTP id y1-20020a056000108100b0022a2ecf9cf8mr10352984wrw.205.1663592433576; Mon, 19 Sep 2022 06:00:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/03JjNu6nzxhkJ6oeY9SrUK1mlqWsqMgoNYn2lZOFLRJuPsEjfI8dvQclxVn8sladUMQLhg== X-Received: by 2002:a05:6000:1081:b0:22a:2ecf:9cf8 with SMTP id y1-20020a056000108100b0022a2ecf9cf8mr10352962wrw.205.1663592433266; Mon, 19 Sep 2022 06:00:33 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Mon, 19 Sep 2022 15:00:30 +0200 Message-Id: <20220919130030.70997-2-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Subject: [Patchew-devel] [PATCH] models: improve topic+project index X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchew-devel-bounces@redhat.com Sender: "Patchew-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1663592450949100001 Content-Type: text/plain; charset="utf-8" Since most queries are project-specific, an index that places the topic first is more effective than one that places it second. In fact, a topic-first index is even already present in the database and can be useful for queries that are not specific to a project. Signed-off-by: Paolo Bonzini --- api/migrations/0071_auto_20220919_1251.py | 17 +++++++++++++++++ api/models.py | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 api/migrations/0071_auto_20220919_1251.py diff --git a/api/migrations/0071_auto_20220919_1251.py b/api/migrations/007= 1_auto_20220919_1251.py new file mode 100644 index 0000000..3b1e089 --- /dev/null +++ b/api/migrations/0071_auto_20220919_1251.py @@ -0,0 +1,17 @@ +# Generated by Django 3.1.14 on 2022-09-19 12:51 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies =3D [ + ('api', '0070_auto_20220919_1016'), + ] + + operations =3D [ + migrations.AlterIndexTogether( + name=3D'message', + index_together=3D{('topic', 'last_reply_date'), ('project', 't= opic', 'date'), ('project', 'topic', 'last_reply_date'), ('topic', 'date')}, + ), + ] diff --git a/api/models.py b/api/models.py index 6bb9867..721366d 100644 --- a/api/models.py +++ b/api/models.py @@ -966,8 +966,8 @@ class Message(models.Model): class Meta: unique_together =3D ("project", "message_id") index_together =3D [ - ("topic", "project", "last_reply_date"), - ("topic", "project", "date"), + ("project", "topic", "last_reply_date"), + ("project", "topic", "date"), ("topic", "last_reply_date"), ("topic", "date"), ] --=20 2.37.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://listman.redhat.com/mailman/listinfo/patchew-devel