Querying for allSpecies and homeworld executes 38 SQL queries
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- backend-api-design, databases
Hướng nghiên cứu
Bắt đầu với truy vấn allSpecies và SQL trace trong issue, sau đó kiểm tra Graphene-Django resolver và đường dẫn Django ORM tải từng homeworld. So sánh select_related() và prefetch_related() cho mối quan hệ này và dùng truy vấn được báo cáo làm baseline; được xem là hoàn thành khi ví dụ giảm request xuống còn một hoặc hai truy vấn SQL.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This query:
{
allSpecies {
edges {
node {
name
homeworld {
name
gravity
}
}
}
}
}
Executes 38 sql queries, looking something like this:
(0.001) SELECT COUNT(*) AS "__count" FROM "starwars_species"; args=()
(0.000) SELECT "starwars_species"."id", "starwars_species"."created",
"starwars_species"."edited", "starwars_species"."name",
"starwars_species"."classification", "starwars_species"."designation",
"starwars_species"."average_height", "starwars_species"."skin_colors",
"starwars_species"."hair_colors", "starwars_species"."eye_colors",
"starwars_species"."average_lifespan", "starwars_species"."homeworld_id",
"starwars_species"."language" FROM "starwars_species" LIMIT 37; args=()
(0.000) SELECT "starwars_planet"."id", "starwars_planet"."created",
"starwars_planet"."edited", "starwars_planet"."name",
"starwars_planet"."rotation_period", "starwars_planet"."orbital_period",
"starwars_planet"."diameter", "starwars_planet"."climate",
"starwars_planet"."gravity", "starwars_planet"."terrain",
"starwars_planet"."surface_water", "starwars_planet"."population" FROM
"starwars_planet" WHERE "starwars_planet"."id" = 9; args=(9,)
(0.000) SELECT "starwars_planet"."id", "starwars_planet"."created",
"starwars_planet"."edited", "starwars_planet"."name",
"starwars_planet"."rotation_period", "starwars_planet"."orbital_period",
"starwars_planet"."diameter", "starwars_planet"."climate",
"starwars_planet"."gravity", "starwars_planet"."terrain",
"starwars_planet"."surface_water", "starwars_planet"."population" FROM
"starwars_planet" WHERE "starwars_planet"."id" = 14; args=(14,)
... repeat another 36 times
Full list here: https://gist.github.com/simonw/762a98de85a2f113d1d7ec6026f73ee4
Is it possible to detect this case and then use select_related() or prefetch_related() here to join against the relevant table and get everything done in just one or two queries?
If so, an example showing how to do that would be a fantastic illustration of a slightly more complex use-case for graphene-django (I tried myself and couldn't figure out how to do it).
- Ngôn ngữ chính
- Python
- Star
- 174
- Fork
- 33
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của graphql-python/swapi-graphene
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
graphql-python/swapi-graphene#14 · 1 bình luận ·
-
Support for Github GraphQL Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của graphql-python/swapi-graphene
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
rules
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
huggingface/Repo2RLEnv#163 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
huggingface/sentence-transformers#4074 ·
-
comp/dashboard invalid P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
NousResearch/hermes-agent#121143 ·