Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number field search is slow #5970

Open
jwj61 opened this issue Mar 25, 2024 · 4 comments
Open

Number field search is slow #5970

jwj61 opened this issue Mar 25, 2024 · 4 comments
Labels
number fields Number fields

Comments

@jwj61
Copy link
Member

jwj61 commented Mar 25, 2024

From the feedback page, the following search times out:

https://www.lmfdb.org/NumberField/?degree=2&sort_order=h&sort_order=h

@edgarcosta
Copy link
Member

lmfdb=# EXPLAIN ANALYZE SELECT "class_group", "coeffs", "degree", "r2", "disc_abs", "disc_sign", "galois_label", "label", "ramps", "used_grh", "cm", "is_galois", "torsion_order", "regulator", "rd", "grd", "monogenic", "num_ram" FROM "nf_fields" WHERE "degree" = 2 ORDER BY "class_number", "degree", "disc_abs", "disc_sign", "iso_number" LIMIT 50;
                                                                               QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=5938.35..6215.52 rows=50 width=232) (actual time=101555.912..101555.929 rows=50 loops=1)
   ->  Incremental Sort  (cost=5938.35..7476412.54 rows=1347641 width=232) (actual time=101555.910..101555.920 rows=50 loops=1)
         Sort Key: class_number, disc_abs, disc_sign, iso_number
         Presorted Key: class_number
         Full-sort Groups: 1  Sort Method: quicksort  Average Memory: 42kB  Peak Memory: 42kB
         Pre-sorted Groups: 1  Sort Method: top-N heapsort  Average Memory: 38kB  Peak Memory: 38kB
         ->  Index Scan using nf_fields_class_number_id on nf_fields  (cost=0.56..7390705.86 rows=1347641 width=232) (actual time=0.189..101423.677 rows=177169 loops=1)
               Filter: (degree = 2)
               Rows Removed by Filter: 10112321
 Planning Time: 3.294 ms
 Execution Time: 101556.213 ms
(11 rows)

@edgarcosta
Copy link
Member

I will manually add an index on the right sort statement, and see if things improve

@edgarcosta
Copy link
Member

fixed

lmfdb=# EXPLAIN ANALYZE SELECT "class_group", "coeffs", "degree", "r2", "disc_abs", "disc_sign", "galois_label", "label", "ramps", "used_grh", "cm", "is_galois", "torsion_order", "regulator", "rd", "grd", "monogenic", "num_ram" FROM "nf_fields" WHERE "degree" = 2 ORDER BY "class_number", "degree", "disc_abs", "disc_sign", "iso_number" LIMIT 50;
                                                                      QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=0.56..277.11 rows=50 width=232) (actual time=0.076..0.129 rows=50 loops=1)
   ->  Index Scan using nf_fields_cl_di_di_is on nf_fields  (cost=0.56..7460175.48 rows=1348802 width=232) (actual time=0.075..0.123 rows=50 loops=1)
         Filter: (degree = 2)
         Rows Removed by Filter: 25
 Planning Time: 0.601 ms
 Execution Time: 0.156 ms
(6 rows)

@jwj61 jwj61 reopened this Apr 24, 2024
@jwj61
Copy link
Member Author

jwj61 commented Apr 24, 2024

The feedback page reports that this similar search times out:

https://www.lmfdb.org/NumberField/?degree=8&cm_field=yes&sort_order=h&sort_order=h

@AndrewVSutherland AndrewVSutherland added the number fields Number fields label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
number fields Number fields
Projects
None yet
Development

No branches or pull requests

3 participants