Spaces:
Paused
Paused
Commit ·
dd08f57
1
Parent(s): cac96f2
feat(bidder): simplify SQL queries by removing unnecessary index hints for improved readability
Browse files
DATABASE_CHANGES_CONSOLIDATED.sql
CHANGED
|
@@ -140,10 +140,7 @@ BEGIN
|
|
| 140 |
[ProjNo] ASC,
|
| 141 |
[Id] ASC
|
| 142 |
)
|
| 143 |
-
INCLUDE (
|
| 144 |
-
[CustId], [Quote], [DateLastContact], [DateFollowup], [Primary],
|
| 145 |
-
[CustType], [EmailAddress], [ReplacementCost], [Enabled]
|
| 146 |
-
)
|
| 147 |
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF,
|
| 148 |
DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS = ON,
|
| 149 |
ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY];
|
|
|
|
| 140 |
[ProjNo] ASC,
|
| 141 |
[Id] ASC
|
| 142 |
)
|
| 143 |
+
INCLUDE ([CustId])
|
|
|
|
|
|
|
|
|
|
| 144 |
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF,
|
| 145 |
DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS = ON,
|
| 146 |
ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY];
|
app/db/repositories/bidder_repo.py
CHANGED
|
@@ -85,11 +85,13 @@ class BidderRepository:
|
|
| 85 |
b.Id,
|
| 86 |
b.ReplacementCost as replacement_cost,
|
| 87 |
b.Enabled as enabled
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
|
|
|
|
|
|
| 93 |
"""
|
| 94 |
)
|
| 95 |
else:
|
|
@@ -108,8 +110,8 @@ class BidderRepository:
|
|
| 108 |
b.Id,
|
| 109 |
b.ReplacementCost as replacement_cost,
|
| 110 |
b.Enabled as enabled
|
| 111 |
-
FROM Bidders b
|
| 112 |
-
LEFT JOIN Customers c
|
| 113 |
WHERE b.ProjNo = :project_no
|
| 114 |
ORDER BY b.[Primary] DESC, b.Id
|
| 115 |
OFFSET :offset ROWS FETCH NEXT :limit ROWS ONLY
|
|
@@ -152,8 +154,8 @@ class BidderRepository:
|
|
| 152 |
b.Id,
|
| 153 |
b.ReplacementCost as replacement_cost,
|
| 154 |
b.Enabled as enabled
|
| 155 |
-
FROM Bidders b
|
| 156 |
-
LEFT JOIN Customers c
|
| 157 |
WHERE b.ProjNo = :project_no AND b.CustId = :customer_id
|
| 158 |
"""
|
| 159 |
)
|
|
@@ -190,8 +192,8 @@ class BidderRepository:
|
|
| 190 |
b.Id,
|
| 191 |
b.ReplacementCost as replacement_cost,
|
| 192 |
b.Enabled as enabled
|
| 193 |
-
FROM Bidders b
|
| 194 |
-
LEFT JOIN Customers c
|
| 195 |
WHERE b.CustId = :customer_id
|
| 196 |
ORDER BY b.ProjNo DESC, b.Id
|
| 197 |
OFFSET :offset ROWS FETCH NEXT :limit ROWS ONLY
|
|
|
|
| 85 |
b.Id,
|
| 86 |
b.ReplacementCost as replacement_cost,
|
| 87 |
b.Enabled as enabled
|
| 88 |
+
FROM Bidders b
|
| 89 |
+
LEFT JOIN Customers c
|
| 90 |
+
ON b.CustId = c.CustomerID
|
| 91 |
+
WHERE b.ProjNo = :project_no
|
| 92 |
+
AND b.Id > :last_id
|
| 93 |
+
ORDER BY b.Id ASC
|
| 94 |
+
OFFSET 0 ROWS FETCH NEXT :limit ROWS ONLY
|
| 95 |
"""
|
| 96 |
)
|
| 97 |
else:
|
|
|
|
| 110 |
b.Id,
|
| 111 |
b.ReplacementCost as replacement_cost,
|
| 112 |
b.Enabled as enabled
|
| 113 |
+
FROM Bidders b
|
| 114 |
+
LEFT JOIN Customers c ON b.CustId = c.CustomerID
|
| 115 |
WHERE b.ProjNo = :project_no
|
| 116 |
ORDER BY b.[Primary] DESC, b.Id
|
| 117 |
OFFSET :offset ROWS FETCH NEXT :limit ROWS ONLY
|
|
|
|
| 154 |
b.Id,
|
| 155 |
b.ReplacementCost as replacement_cost,
|
| 156 |
b.Enabled as enabled
|
| 157 |
+
FROM Bidders b
|
| 158 |
+
LEFT JOIN Customers c ON b.CustId = c.CustomerID
|
| 159 |
WHERE b.ProjNo = :project_no AND b.CustId = :customer_id
|
| 160 |
"""
|
| 161 |
)
|
|
|
|
| 192 |
b.Id,
|
| 193 |
b.ReplacementCost as replacement_cost,
|
| 194 |
b.Enabled as enabled
|
| 195 |
+
FROM Bidders b
|
| 196 |
+
LEFT JOIN Customers c ON b.CustId = c.CustomerID
|
| 197 |
WHERE b.CustId = :customer_id
|
| 198 |
ORDER BY b.ProjNo DESC, b.Id
|
| 199 |
OFFSET :offset ROWS FETCH NEXT :limit ROWS ONLY
|