JOIN commands can be improved to execute in less time
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Lĩnh vực
- data, documentation
Hướng nghiên cứu
Tìm bài học Episode 6 và chuỗi neighbours_query của bài học đó, sau đó so sánh truy vấn hiện tại với JOIN được lọc và các cột được chọn theo đề xuất. Xác minh rằng truy vấn đã cập nhật trả về các trường mong muốn và hoàn tất mà không bị hết thời gian chờ đối với ví dụ trong tutorial.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
How could the content be improved?
I was running into some problems using the JOIN queries in Episode 6. The query would take hours and simply time out. This could be because when the JOIN command is run, for example, between gaiadr2.source_id and panstarrs1_best_neighbor.source_id, it is perhaps evaluated for the entire database before filtering for ra and dec (Source: ChatGPT -- so take explanation with a grain of salt).
I eventually figured out how to create subqueries and how to force the order of the queries so that only the filtered Gaia results were considered during the join with panstarrs1_best_neighbor. However, the operation still seemed to take over an hour. So in addition to that, I found that filtering out just the columns needed from each table (using another subquery) and using the OFFSET 0 modifier in order to to force the order of operations (see Gaia tutorials on combining tables) reduced the query time from hours (or completely stalling) to 30 seconds or less.
Here is an example, which could replace the neighbours_query string in the tutorial:
"""SELECT
gaia.source_id, gaia.ra, gaia.dec, gaia.pmra, gaia.pmdec,
best.source_id, best.original_ext_source_id,
best.best_neighbour_multiplicity, best.number_of_mates
FROM (
SELECT source_id, ra, dec, pmra, pmdec
FROM gaiadr2.gaia_source
WHERE 1=CONTAINS(
POINT(ra, dec),
CIRCLE(88.8, 7.4, 0.08333333)
)
OFFSET 0) as gaia
JOIN (
SELECT source_id, original_ext_source_id, best_neighbour_multiplicity, number_of_mates
FROM gaiadr2.panstarrs1_best_neighbour
OFFSET 0) AS best
ON gaia.source_id = best.source_id
"""
This particular query ran in less than 10 seconds. It looks a lot more complicated, but it could make things easier for folks who are trying to execute this workshop in one day.
Which part of the content does your suggestion apply to?
Episode 6
- Ngôn ngữ chính
- Python
- Star
- 36
- Fork
- 39
- Merge trung bình
- 3 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 tương tự
-
changelog investigate
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ramnes/notion-sdk-py#409 ·
-
good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
lindicaphxag-tech/kaggle#28 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
BSData/horus-heresy-3rd-edition#3211 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Unreachable-proxy mount test depends on fixed port 9999Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày