Revision b877d633
Von G. Richardson vor mehr als 5 Jahren hinzugefügt
SL/DB/Part.pm | ||
---|---|---|
373 | 373 |
LEFT JOIN warehouse w ON (i.warehouse_id = w.id) |
374 | 374 |
LEFT JOIN bin b ON (i.bin_id = b.id) |
375 | 375 |
WHERE parts_id = ? |
376 |
GROUP BY w.description, b.description, p.unit, i.parts_id |
|
376 |
GROUP BY w.description, w.sortkey, b.description, p.unit, i.parts_id
|
|
377 | 377 |
HAVING SUM(qty) != 0 |
378 | 378 |
WINDOW pt AS (PARTITION BY i.parts_id ORDER BY w.sortkey, b.description, p.unit), |
379 | 379 |
wh AS (PARTITION by w.description ORDER BY w.sortkey, b.description, p.unit) |
sql/Pg-upgrade2/inventory_itime_parts_id_index.sql | ||
---|---|---|
1 |
-- @tag: inventory_itime_parts_id_index |
|
2 |
-- @description: Index auf inventory itime und parts_id, um schnell die letzten Transaktion raussuchen zu können |
|
3 |
-- @depends: release_3_5_4 |
|
4 |
|
|
5 |
-- increase speed of queries such as |
|
6 |
|
|
7 |
-- last 10 entries in inventory: |
|
8 |
-- SELECT * FROM inventory ORDER BY itime desc LIMIT 10 |
|
9 |
|
|
10 |
-- last 10 inventory entries for a certain part: |
|
11 |
-- SELECT * FROM inventory WHERE parts_id = 1234 ORDER BY itime desc LIMIT 10 |
|
12 |
|
|
13 |
CREATE INDEX inventory_itime_parts_id_idx ON inventory (itime, parts_id); |
Auch abrufbar als: Unified diff
Neuer index auf inventory über itime und parts_id
Um Abfragen wiezu beschleunigen