Skip to content

sql: severe regression in ORM query performance {django} #96218

@dikshant

Description

@dikshant

I was investigating ORM query performance in CRDB 22.2.2 as well as latest (g69dd453d0e) and noticed some major regressions for Django's table introspection query when testing on Roachprod.

Steps to repro:

  1. Create two separate 9 node multi region roachprod cluster using 22.2.2 and latest
roachprod create rp-test -n 9 --gce-zones 'us-east4-a','us-east4-a','us-east4-a','us-west2-a','us-west2-a','us-west2-a','us-central1-a','us-central1-a','us-central1-a' && roachprod stage rp-test release v22.2.2 && roachprod start rp-test:1-9
  1. Create lots of tables. (15k)
for i in $(seq 1 15000); do echo "CREATE TABLE t_$i (i INT PRIMARY KEY, j INT);" >> out.sql;
cat out.sql | roachprod sql rp-test
  1. Run the following query in both clusters:
              SELECT
                c.relname,
                CASE
                    WHEN c.relispartition THEN 'p'
                    WHEN c.relkind IN ('m', 'v') THEN 'v'
                    ELSE 't'
                END,
                obj_description(c.oid, 'pg_class')
            FROM pg_catalog.pg_class c
            LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
            WHERE c.relkind IN ('f', 'm', 'p', 'r', 'v')
                AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
                AND pg_catalog.pg_table_is_visible(c.oid);
  1. Observe that latest (g69dd453d0e) takes a lot longer than 22.2.2 and the query plans are different.

Jira issue: CRDB-24010

Metadata

Metadata

Assignees

Labels

C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.C-investigationFurther steps needed to qualify. C-label will change.GA-blockerT-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)branch-release-23.1Used to mark GA and release blockers, technical advisories, and bugs for 23.1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions