indexing

What is the index key size limit in MariaDB?

扶醉桌前 提交于 2019-12-20 04:21:17
问题 In MySQL " An index key for a single-column index can be up to 767 bytes. The same length limit applies to any index key prefix. " Reviewing and searching the MariaDB documentation I cannot find a reference to this, or a similar, limit. What is this limit? What is the link to the documentation page I didn't find? 回答1: It is a bit hidden, but e.g. https://mariadb.com/kb/en/mariadb/documentation/storage-engines/converting-tables-from-myisam-to-innodb/ says: The maximum length of an INDEX is

MongoDB - Full Text Index - Full Text Search - stemming

二次信任 提交于 2019-12-20 04:12:17
问题 I noticed that if I enter the value 'seasons' in a full text search enabled string field of some collection, then MongoDB finds this value when I query for 'season'. But if I enter something more complex like e.g. 'mice' or 'criteria', it does not find these values when I query for 'mouse' or 'criterion' respectively. Is that normal and are there any clear rules what MongoDB is able to stem and what not? [test] 2014-03-30 18:25:09.551 >>> db.TestFullText7.find(); { "_id" : ObjectId(

Why are regex capturing groups indexed at one?

巧了我就是萌 提交于 2019-12-20 03:59:27
问题 Part of me is worries that this question will get closed, but I'm genuinely baffled by something. In every language's regex that I've used, the capturing groups are indexed at one, even when the rest of the language is indexed at zero. I thought of design decisions that would lead to 1-indexing, which is usually to lower the barrier to entry for non-technical people, however when it comes to regex, which is already hellish and incomprehensible, this argument doesn't really seem to hold.

In MongoDB, if an index is on 3 fields, we can use that index when querying on 2 fields? (wildcard on the 3rd field)

我们两清 提交于 2019-12-20 03:41:13
问题 If there is an index on page_type, our_id, date and when querying, db.analytics.find({page_type: 'ingredients', ga_date: {$gte : new Date('Wed Sep 08 2010 12:00:00 GMT-0800')}}) db.analytics.find({page_type: 'ingredients', ga_date: {$gte : new Date('Wed Sep 08 2010 12:00:00 GMT-0800')}}).explain() if our_id is omitted, or date is omitted, it can still use the index, with something like the following in the explain() output: "our_id" : [ [ { "$minElement" : 1 }, { "$maxElement" : 1 } ] ], even

UNIQUE argument for INDEX creation - what's for?

喜你入骨 提交于 2019-12-20 03:19:21
问题 Why does INDEX creation statement have UNIQUE argument? As I understand, the non-clustered index contains a bookmark, a pointer to a row, which should be unique to distinguish even non-unique rows, so insuring non-clustered index to be unique ? Correct? So, do I understand that no-unique index can be only on clustered table? since "A clustered index on a view must be unique" [1] Since "The bottom, or leaf, level of the clustered index contains the actual data rows of the table" [1], do I

Simple MongoDB query very slow although index is set

ぃ、小莉子 提交于 2019-12-20 03:17:51
问题 I've got a MongoDB collection that holds about 100M documents. The documents basically look like this: _id : ObjectId("asd1234567890") _reference_1_id : ObjectId("fgh4567890123") _reference_2_id : ObjectId("jkl7890123456") name : "Test1" id : "4815162342" created_time : Date( 1331882436000 ) _contexts : ["context1", "context2"] ... There are some indexes set, here's the output of db.mycoll.getIndexes(); [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "mydb.mycoll", "name" : "_id_" }, { "v" : 1,

IN clause not using index

僤鯓⒐⒋嵵緔 提交于 2019-12-20 02:52:25
问题 Here is the table definition CREATE TABLE `dt_prdtime` ( `TCompany` varchar(3) NOT NULL DEFAULT '', `TPerCode` varchar(8) NOT NULL, `TBegDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'วันที่', `TQPay` int(1) NOT NULL DEFAULT '2', `TYear` int(4) NOT NULL, `TMonth` int(2) NOT NULL, PRIMARY KEY (`TCompany`,`TPerCode`,`TBegDateTime`), KEY `TMonth` (`TMonth`) USING BTREE, KEY `TPerCode` (`TPerCode`,`TYear`,`TMonth`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 And this is data sample.

Multi-column database indexes and query speed

佐手、 提交于 2019-12-20 02:36:20
问题 I'm deploying a Rails application that aggregates coupon data from various third-party providers into a searchable database. Searches are conducted across four fields for each coupon: headline, coupon code, description, and expiration date. Because some of these third-party providers do a rather bad job of keeping their data sorted, and because I don't want duplicate coupons to creep into my database, I've implemented a unique compound index across those four columns. That prevents the same

Multi-column database indexes and query speed

倾然丶 夕夏残阳落幕 提交于 2019-12-20 02:36:07
问题 I'm deploying a Rails application that aggregates coupon data from various third-party providers into a searchable database. Searches are conducted across four fields for each coupon: headline, coupon code, description, and expiration date. Because some of these third-party providers do a rather bad job of keeping their data sorted, and because I don't want duplicate coupons to creep into my database, I've implemented a unique compound index across those four columns. That prevents the same

MySQL query optimization of LIKE term% ORDER BY int

白昼怎懂夜的黑 提交于 2019-12-20 02:26:20
问题 My question is regarding the handling of MySQL index on VARCHAR combined with an int COLUMN when using prefix matching. e.g. if I have such a query: SELECT * FROM tbl WHERE name LIKE 'query%' ORDER BY weight DESC LIMIT 5 Considering I have one index one name->weight, does that index need to find all apperances of the prefix query and then ORDER BY, or does he keeps the cross calculation indexed even with the use of prefix matching (%). I'm troubled by it, because for popular names (e.g. query