X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44..53593baa211863fbf66540cf1bcc36c8fb37257f:/sql/Pg-upgrade2/inventory_itime_parts_id_index.sql

diff --git a/sql/Pg-upgrade2/inventory_itime_parts_id_index.sql b/sql/Pg-upgrade2/inventory_itime_parts_id_index.sql
new file mode 100644
index 000000000..36cd99c9d
--- /dev/null
+++ b/sql/Pg-upgrade2/inventory_itime_parts_id_index.sql
@@ -0,0 +1,13 @@
+-- @tag: inventory_itime_parts_id_index
+-- @description: Index auf inventory itime und parts_id, um schnell die letzten Transaktion raussuchen zu kÃ¶nnen
+-- @depends: release_3_5_4
+
+-- increase speed of queries such as
+
+-- last 10 entries in inventory:
+-- SELECT * FROM inventory ORDER BY itime desc LIMIT 10
+
+-- last 10 inventory entries for a certain part:
+-- SELECT * FROM inventory WHERE parts_id = 1234 ORDER BY itime desc LIMIT 10
+
+CREATE INDEX inventory_itime_parts_id_idx ON inventory (itime, parts_id);
