diff --git a/CHANGELOG.md b/CHANGELOG.md
index 83c02c9a489b2faaf7dc1af197764c1687c7911c..dcc713b8ae75b1da484df279b98003cbae13df0b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,12 +23,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
   Adapter](https://gitlab.com/caosdb/caosdb-webui-legacy-adapter) has been
   added. It is disabled by default because it depends not only on the server's
   GRPC API but also on a proxy translating WebGRPC/HTTP1.1 (browser) requests
-  to GRPC/HTTP2 (server) and vice versa.  
+  to GRPC/HTTP2 (server) and vice versa.
   The new map should work as a drop-in for the legacy map with the exact
   functionality of the old map and the same config files. However, the new map
   also implements a new behavior for the query button: The query will be
   executed immediately, see
-  [caosdb-webui#205](https://gitlab.com/caosdb/caosdb-webui/-/issues/205).  
+  [caosdb-webui#205](https://gitlab.com/caosdb/caosdb-webui/-/issues/205).
   You can enable the new map by disabling the old one AND placing a valid
   configuration at `conf/ext/json/ext_map.json`. A suitable proxy is envoy and
   a suitable envoy.yaml can be found in `misc/envoy.yaml`. Please have a look
@@ -50,7 +50,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
   [caosdb-webui#226](https://gitlab.com/caosdb/caosdb-webui/-/issues/226)
 * Fixed broken download of referenced files in the export of select statements.
   https://gitlab.com/linkahead/linkahead-webui/-/issues/238
-* Fixed breaking timestamps due to whitespace [caosdb-webui#239](https://gitlab.com/caosdb/caosdb-webui/-/issues/239)
+* Do not send unpaged queries during Edit Mode usage. Fixes
+  [caosdb-webui#217](https://gitlab.com/linkahead/linkahead-webui/-/issues/217)
+* Fixed breaking timestamps due to whitespace
+  [caosdb-webui#239](https://gitlab.com/caosdb/caosdb-webui/-/issues/239)
 
 ### Security ###
 
diff --git a/build.properties.d/00_default.properties b/build.properties.d/00_default.properties
index 99a031cef8e9d9f55a723d8ad325bff710b1217d..96017406e54c3275ed9b5884f7292ca8611e6142 100644
--- a/build.properties.d/00_default.properties
+++ b/build.properties.d/00_default.properties
@@ -151,6 +151,12 @@ BUILD_FOOTER_CUSTOM_ELEMENT_TWO='<p class="caosdb-footer-element"> <a href="http
 ##############################################################################
 BUILD_MODULE_EXT_TRIGGER_CRAWLER_FORM_TOOLBOX="Tools"
 
+##############################################################################
+# Reduce the number of candidates for references in the edit mode to this
+# value. -1 means: no limit.
+##############################################################################
+BUILD_MAX_EDIT_MODE_DROPDOWN_OPTIONS=-1
+
 ##############################################################################
 # Build a dist file containing all JS code from the files in the
 # MODULE_DEPENDENCIES array.
diff --git a/src/core/js/edit_mode.js b/src/core/js/edit_mode.js
index ae165735a6aabef916fa0a2d023596d89ce000a1..1a2c9092c2b6d234cc52691089c7094e93c49a2a 100644
--- a/src/core/js/edit_mode.js
+++ b/src/core/js/edit_mode.js
@@ -981,7 +981,7 @@ var edit_mode = new function () {
                 let time = dateandtime[1];
                 // subseconds are stored in the subsec attribue of the input element
                 result = "<span><input type='date' value='" + date + "'/>" +
-                    "<input type='time' subsec='"+dateandtime[2]+"' value='" + time + "'/></span>";
+                    "<input type='time' subsec='" + dateandtime[2] + "' value='" + time + "'/></span>";
             } else if (property.value && ((property.name || "").toLowerCase() == "year" || (date.match(/-/g) || []).length == 0)) {
                 // Year
                 result = "<input type='number' value='" + date + "'/>";
@@ -1016,9 +1016,60 @@ var edit_mode = new function () {
 
                 const select = $('<select data-container="body" data-virtual-scroll="100" data-window-padding="15" data-live-search="true" class="selectpicker form-control caosdb-list-' + property.datatype + '" data-resolved="false"><option value=""></option></select>');
                 options.then((_options) => {
+                    // The options might not include all entites (if there are
+                    // many). Include the property value if it is missing.
+                    if (property.value != "" && -1 == _options.map((e) => {
+                            return e.value
+                        }).indexOf(property.value)) {
+                        _options = _options.concat([$(`<option value="${property.value}">ID: ${property.value}</option>`)[0]])
+                    }
                     edit_mode.fill_reference_drop_down(select[0], _options, property.value);
                     result.empty();
                     result.append(select);
+                    // value=NA means that the first element is the warning that not all entities are provided
+                    if (_options.length > 0 && _options[0].getAttribute('value') == "NA") {
+                        // The button to show the input field for manual ID insertion
+                        var manualInsertButton = $('<button title="Insert Entity Id manually." class="btn btn-link caosdb-update-entity-button caosdb-f-list-item-button"><i class="bi-pencil"></i></button>');
+                        $(manualInsertButton).click(function () {
+                            // toggle input
+                            // forward:
+                            if ($(result).find('input.caosdb-f-manual-id-insert').is(':hidden')){
+                                // show ID input; hide dropdown
+                                $(result).find('.dropdown').hide();
+                                $(result).find('input.caosdb-f-manual-id-insert').show();
+                                $('.caosdb-f-entity-save-button').hide()
+                            } else {
+                                // backward:
+                                $(result).find('input.caosdb-f-manual-id-insert')[0].dispatchEvent(new KeyboardEvent('keyup', {'key':'Enter'}));
+                            }
+                        });
+                        // Add input for manual ID insertion
+                        var idinput = $("<input type='number' class='caosdb-f-manual-id-insert' value=''></input>")
+                        idinput.hide()
+                        // Add callback for pressing Enter: the insertion is completed
+                        idinput.on('keyup', function (e) {
+                            if (e.key === 'Enter' || e.keyCode === 13) {
+                                // hide the input, show the dropdown again and append the value that
+                                // was entered to the candidates and select that item
+                                $(result).find('input.caosdb-f-manual-id-insert').hide();
+                                var sel_id = $(result).find('input.caosdb-f-manual-id-insert')[0].value
+                                if (sel_id!=""){
+                                    if ($(result).find(`option[value="${sel_id}"]`).length==0){
+                                        select.append(`<option value="${sel_id}">ID: ${sel_id}</option>`);
+                                        // workaround for selectpicker bug (options are
+                                        // doubled otherwise)
+                                        select.selectpicker('destroy');
+                                        select.selectpicker();
+                                    }
+                                    select.selectpicker('val', `${sel_id}`);
+                                }
+                                $(result).find('.dropdown').show();
+                                $('.caosdb-f-entity-save-button').show()
+                            }
+                        });
+                        result.append(idinput);
+                        result.parent().append(manualInsertButton);
+                    }
                     edit_mode._init_select(select);
                 });
             }
@@ -1841,8 +1892,13 @@ var edit_mode = new function () {
      */
     this.retrieve_datatype_list = async function (datatype) {
         var find_entity = ["FILE", "REFERENCE"].includes(datatype) ? "" : `"${datatype}"`;
-        var entities = datatype !== "FILE" ? edit_mode.query(`FIND Record ${find_entity}`, true) : [];
-        var files = edit_mode.query(`FIND File ${find_entity}`, true);
+        const max_options = parseInt("${BUILD_MAX_EDIT_MODE_DROPDOWN_OPTIONS}"); //for each query; there might be more candidates in total
+        if (max_options != -1){
+            var n_entities = datatype !== "FILE" ? await edit_mode.query(`COUNT Record ${find_entity}`, true) : 0;
+            var n_files = await edit_mode.query(`COUNT File ${find_entity}`, true);
+        }
+        var entities = datatype !== "FILE" ? edit_mode.query(`FIND Record ${find_entity}&P=0L${max_options}`, true) : [];
+        var files = edit_mode.query(`FIND File ${find_entity}&P=0L${max_options}`, true);
 
         await Promise.all([entities, files])
 
@@ -1851,8 +1907,13 @@ var edit_mode = new function () {
             .concat(edit_mode
                 ._create_reference_options(await files));
 
+        if (max_options !=- 1 && (n_entities > max_options || n_files > max_options)) {
+            // add notification that not all entities are shown
+            options = [$(`<option disabled=true value="NA"/>`).text(
+                `More than ${max_options} possible options; showing only a subset. You may need to enter the id manually.`
+            )[0]].concat(options);
+        }
         return options;
-
     }
 
     this.highlight = function (entity) {
@@ -2094,11 +2155,17 @@ var edit_mode = new function () {
 
     const query_cache = {};
 
-    this.query = (str, use_cache) => {
+    this.query = async (str, use_cache) => {
         if (use_cache && query_cache[str]) {
             return query_cache[str];
         }
-        const result = query(str);
+        var result;
+        if (str.toUpperCase().startsWith('COUNT')) {
+            const res = await connection.get(`Entity/?query=${str}`);
+            result = $(res).find('Query').attr('results')
+        } else {
+            result = query(str);
+        }
         if (use_cache) {
             query_cache[str] = result;
         }
diff --git a/src/doc/extension/edit_mode.rst b/src/doc/extension/edit_mode.rst
new file mode 100644
index 0000000000000000000000000000000000000000..b03657ee754832dbbfdcbaa81d7a503a758f82cb
--- /dev/null
+++ b/src/doc/extension/edit_mode.rst
@@ -0,0 +1,15 @@
+
+Customizing the Edit Mode
+=========================
+
+
+Customizing the number of candidates retrieved for references in the Edit Mode
+------------------------------------------------------------------------------
+
+To prevent the retrieval of huge numbers of entities just to create candidates
+for the drop down of a reference during editing of an Entity, the number of
+candidates can be limited.
+
+Set the ``BUILD_MAX_EDIT_MODE_DROPDOWN_OPTIONS`` build variable. -1 means no
+limit; every other number is the limit for each query sent (The number of
+candidates can be at most twice this number).
diff --git a/src/doc/tutorials/edit_mode.rst b/src/doc/tutorials/edit_mode.rst
index a2a0310f6f715fabeb8423dcdb3e499ed5d7d256..f7f50508856bc1abfbd3b04e28c20b7fa7c1a385 100644
--- a/src/doc/tutorials/edit_mode.rst
+++ b/src/doc/tutorials/edit_mode.rst
@@ -73,13 +73,21 @@ the corresponding area at the top of the Record. Similarly, Properties
 can be added by dragging Properties (or RecordTypes) from the list in the edit mode toolbox
 to the corresponding area at the bottom of the Record. Properties and
 parents can be removed from the entity by clicking on the trash-can
-symbol. Not that a Record must always have at least one parent.
+symbol. Note that a Record must always have at least one parent.
+
+When many Entities are valid candidates for a reference property not all
+might be available in the drop down element. In those cases, the drop down
+warns, that only a subset is shown and a new button with a pencil symbol is
+shown. This allows to enter an ID manually (Click the pencil button, enter the
+ID and press Enter). If you wonder how you find the ID of an entity: You can
+see the ID of an Entity if you click on bar code icon in the upper right corner
+of the Entity card.
 
 Changes will be applied after clicking on ``Save`` or can be discarded
 entirely by clicking ``Cancel``. Existing Properties and RecordTypes
 can be edited in the same way. Note that when changing a RecordType,
 the properties don't have values.
-	 
+
 
 Creating a new Record
 ---------------------
@@ -136,10 +144,10 @@ entity panel, similar to the "New Record" explained above:
             dialog
 
    .. note::
-      
+
       Adding parents currently (May 2023) does not automatically add the parents’ properties
       yet. You will have to do this manually.
-   
+
 3. Add Properties as described above by selecting them from the lists in the edit mode toolbox and
    dragging them to the Property area in the new RecordType. Note that in contrast to Records, the
    Properties of RecordTypes do not have values.
diff --git a/test/core/js/modules/edit_mode.js.js b/test/core/js/modules/edit_mode.js.js
index fa685885683557b0e2e8936e8b60579afd4124c3..86ad39c5b9feb7a171c3e12ed2faba6b8ecdfde6 100644
--- a/test/core/js/modules/edit_mode.js.js
+++ b/test/core/js/modules/edit_mode.js.js
@@ -405,22 +405,12 @@ QUnit.test("retrieve_datatype_list", async function (assert) {
     var query_done;
 
     edit_mode.query = function (query) {
-        var re = /^FIND (Record|File) "IceCore"$/g;
+        var re = /^(FIND|COUNT) (Record|File) "Ice Core"/g;
         assert.ok(query.match(re), `${query} should match ${re}`);
         query_done();
         return [];
     }
-    query_done = assert.async(2);
-    await edit_mode.retrieve_datatype_list("IceCore");
-
-
-    edit_mode.query = function (query) {
-        var re = /^FIND (Record|File) "Ice Core"$/g;
-        assert.ok(query.match(re), `${query} should match ${re}`);
-        query_done();
-        return [];
-    }
-    query_done = assert.async(2);
+    query_done = assert.async(4);
     await edit_mode.retrieve_datatype_list("Ice Core");
 });
 
@@ -847,16 +837,16 @@ QUnit.test("_toggle_list_property", async function (assert) {
 QUnit.test("Bug #95", async function (assert) {
     var query_done;
     edit_mode.query = function (query) {
-        var re = /^FIND (Record|File)\s*$/g;
+        var re = /^(COUNT|FIND) (Record|File)\s*/g;
         assert.ok(query.match(re), `${query} should match ${re}`);
         query_done();
         return [];
     }
 
     // retrieve_datatype_list calls edit_mode.query with correct query string.
-    query_done = assert.async(2);
+    query_done = assert.async(4);
     await edit_mode.retrieve_datatype_list("REFERENCE");
-    query_done = assert.async(1); // only called with file
+    query_done = assert.async(2); // only called with file
     await edit_mode.retrieve_datatype_list("FILE");
 
     var options = async () => { await sleep(100); return [$("<option>1234</option>")[0]]; };
diff --git a/test/core/test.properties b/test/core/test.properties
index efbe015bc5cbcfa5e01418e8f4841d8658ea3786..6dfe80ef6a438bbf96c9bdd81cbc6065fc5f1de8 100644
--- a/test/core/test.properties
+++ b/test/core/test.properties
@@ -1,2 +1,3 @@
 BUILD_MODULE_LEGACY_QUERY_FORM=ENABLED
 BUILD_MODULE_LEGACY_MAP=ENABLED
+BUILD_MAX_EDIT_MODE_DROPDOWN_OPTIONS=5