b-tree-index

Why MongoDB cannot use a compound index that is much similar(not exact) to the query?

大城市里の小女人 提交于 2020-01-01 03:53:10
问题 Consider the below Mongo index strategy and the query, Index: db.collec.ensureIndex({a:1,b:1,c:1}); Query: db.collec.find({"a":"valueA"},{"_id":0,"a":1,"c":1}).sort({"c":-1}).limit(150) The explain on the above query returns: /* 0 */ { "cursor" : "BtreeCursor a_1_b_1_c_1", "isMultiKey" : false, "n" : 150, "nscannedObjects" : 178, "nscanned" : 178, "nscannedObjectsAllPlans" : 279, "nscannedAllPlans" : 279, "scanAndOrder" : true, "indexOnly" : true, "nYields" : 0, "nChunkSkips" : 0, "millis" :

Finding the height of the B-Tree of a table in SQL Server

≯℡__Kan透↙ 提交于 2019-12-07 01:54:10
问题 Since database data is organized in 8k pages in a B-tree, and likewise for PK information information, it should be possible for each table in the database to calculate the height of the B-Tree. Thus revealing how many jumps it takes to reach certain data. Since both row size and PK size is of great importance, it is difficult to calculate since eg varchar(250) need not take up 250 bytes. 1) Is there a way to get the info out of SQL Server? 2) if not, is it possible to give a rough estimate

How to build B-tree index using Apache Spark?

强颜欢笑 提交于 2019-12-06 09:17:45
问题 Now I have a set of numbers, such as 1,4,10,23,... , and I would like to build a b-tree index for them using Apache Spark . The format is per line per record (separated by '/n'). And I have also no idea of the output file's format, I just want to find a recommend one The regular way of building b-tree index are shown in https://en.wikipedia.org/wiki/B-tree, but I now would like a distributed parallel version in Apache Spark . In addition, the Wiki of B-tree introduced a way to build a B-tree

Which index should I use on binary datatype column mysql

大城市里の小女人 提交于 2019-12-05 12:01:48
I am writing a simple tool to check duplicate files(i.e. files having same data). The mechanism is to generate hashes for each file using sha-512 algorithm and then store these hashes in MYSQL database. I store hashes in binary(64) unique not null column. Each row will have a unique binary hash and used to check file is duplicate or not. -- My questions are -- Can I use indexes on binary column, my default table collation is latin1 - default collation? Which Indexing mechanism should I use Btree or Hash, for getting high performance? I need to update or add 100 of rows per seconds. What other

Finding the height of the B-Tree of a table in SQL Server

旧城冷巷雨未停 提交于 2019-12-05 06:10:23
Since database data is organized in 8k pages in a B-tree, and likewise for PK information information, it should be possible for each table in the database to calculate the height of the B-Tree. Thus revealing how many jumps it takes to reach certain data. Since both row size and PK size is of great importance, it is difficult to calculate since eg varchar(250) need not take up 250 bytes. 1) Is there a way to get the info out of SQL Server? 2) if not, is it possible to give a rough estimate using some code analyzing the tables of the db? YES! Of course! Check out the DMV = dynamic management

How to build B-tree index using Apache Spark?

元气小坏坏 提交于 2019-12-04 19:22:30
Now I have a set of numbers, such as 1,4,10,23,... , and I would like to build a b-tree index for them using Apache Spark . The format is per line per record (separated by '/n'). And I have also no idea of the output file's format, I just want to find a recommend one The regular way of building b-tree index are shown in https://en.wikipedia.org/wiki/B-tree , but I now would like a distributed parallel version in Apache Spark . In addition, the Wiki of B-tree introduced a way to build a B-tree to represent a large existing collection of data.(see https://en.wikipedia.org/wiki/B-tree ) It seems

Postgres not using index for date field

天大地大妈咪最大 提交于 2019-12-04 05:35:45
问题 I have created index like CREATE INDEX bill_open_date_idx ON bill USING btree(date(open_date)); and, Column | Type open_date | timestamp without time zone And explain analyse are as follows CASE 1 explain analyze select * from bill where open_date >=date('2018-01-01'); Seq Scan on bill (cost=0.00..345264.60 rows=24813 width=1132) (actual time=0.007..1305.730 rows=5908 loops=1) Filter: (open_date >= '2018-01-01'::date) Rows Removed by Filter: 3238812 Total runtime: 1306.176 ms CASE 2 explain

PostgreSQL daterange not using index correctly

走远了吗. 提交于 2019-12-04 04:02:24
问题 I have a simple table which has a user_birthday field with a type of date (which can be NULL value) CREATE TABLE users ( user_id bigserial NOT NULL, user_email text NOT NULL, user_password text, user_first_name text NOT NULL, user_middle_name text, user_last_name text NOT NULL, user_birthday date, CONSTRAINT pk_users PRIMARY KEY (user_id) ) There's an index (btree) defined on that field, with the rule of NOT user_birthday IS NULL. CREATE INDEX ix_users_birthday ON users USING btree (user

PostgreSQL daterange not using index correctly

情到浓时终转凉″ 提交于 2019-12-01 21:27:16
I have a simple table which has a user_birthday field with a type of date (which can be NULL value) CREATE TABLE users ( user_id bigserial NOT NULL, user_email text NOT NULL, user_password text, user_first_name text NOT NULL, user_middle_name text, user_last_name text NOT NULL, user_birthday date, CONSTRAINT pk_users PRIMARY KEY (user_id) ) There's an index (btree) defined on that field, with the rule of NOT user_birthday IS NULL. CREATE INDEX ix_users_birthday ON users USING btree (user_birthday) WHERE NOT user_birthday IS NULL; Trying to follow up on another idea, I've added the extension