database-indexes

A list of indices in MongoDB?

╄→尐↘猪︶ㄣ 提交于 2019-12-17 17:41:16
问题 Is there a way to see a list of indices on a collection in mongodb in shell? i read through http://www.mongodb.org/display/DOCS/Indexes but i dont see anything 回答1: From the shell: db.test.getIndexes() For shell help you should try: help; db.help(); db.test.help(); 回答2: And if you want to get list of all indexes in your database: use "yourdbname" db.system.indexes.find() 回答3: If you want to list all indexes: db.getCollectionNames().forEach(function(collection) { indexes = db[collection]

Is a hash index never a clustering index?

落爺英雄遲暮 提交于 2019-12-13 08:47:08
问题 From Database System Concepts We use the term hash index to denote hash file structures as well as secondary hash indices. Strictly speaking, hash indices are only secondary index structures . A hash index is never needed as a clustering index structure , since, if a file itself is organized by hashing, there is no need for a separate hash index structure on it. However, since hash file organization provides the same direct access to records that indexing provides, we pretend that a file

Optimization of query using covering indices

一个人想着一个人 提交于 2019-12-13 05:55:13
问题 I have the following query with a subquery and self join: SELECT bucket.patient_sid AS sid FROM (SELECT clinical_data.patient_sid, clinical_data.lft, clinical_data.rgt FROM clinical_data INNER JOIN (SELECT clinical_data.patient_sid, clinical_data.lft, clinical_data.rgt, clinical_data.attribute_id FROM clinical_data WHERE clinical_data.attribute_id = '33' AND clinical_data.string_value = '2160-0') AS attribute ON clinical_data.patient_sid = attribute.patient_sid AND clinical_data.lft >=

T-SQL/CLR function for deterministic encryption

纵然是瞬间 提交于 2019-12-13 00:48:06
问题 I have a table with User Agents Strings table with the following structure: UserAgentStringID INT UserAgentStringValue VARBINARY(8000) The [UserAgentStringValue] field is encrypted with symmetric key. The previous version of the table structure was: UserAgentStringID INT UserAgentStringValue NVARCHAR(4000) UserAgentStringHASH BINARY(32) and I have index on the [UserAgentStringHASH] column in order to optimized searchers. With the new format, such index is not efficient as the ENCRYPTION

Laravel Decimal Column Indexing

こ雲淡風輕ζ 提交于 2019-12-12 04:22:01
问题 I am using the commonly known reddit 'hot' algorithm on my table 'posts'. Now this hot column is a decimal number like this: 'XXXXX,XXXXXXXX' I want this column to be an index, because when I order by 'hot', I want the query to be as fast as possible. However, I am kind of new to indexes. Does an index need to be unique? If it has to be unique, would this work and be efficient? $table->unique('id', 'hot'); If it does not have to be unique, would this be the right approach? $table->index('hot'

Is a single-column index needed when having multicolumn index?

落爺英雄遲暮 提交于 2019-12-11 03:24:20
问题 I've been dropped in a system that was poorly designed. Now I'm doing DBA on their DB, and I have a lot of situation like the following (Pseudo-code): Table t1{ c1; c2; c3; c4; key(c1); key(c2); key(c1,c2); key(c1,c2,c3);} Are the single column indexes really necessary, since I already have a multicolumn one containing those columns? Or on the other hand - is the multiline column needed since I already have the single column ones? 回答1: A short excerpt from the documentation page about how

Table indexes for Text[] array columns

梦想与她 提交于 2019-12-10 16:46:02
问题 I have a PostgreSQL database table with text[] (array) columns defined on it. I'm using these columns to search for a specific record in the database in this way: select obj from business where ((('street' = ANY (address_line_1) and 'a_city' = ANY (city) and 'a_state' = ANY (state)) or ('street' = ANY (address_line_1) and '1234' = ANY (zip_code))) and ('a_business_name' = ANY (business_name) or 'a_website' = ANY (website_url) or array['123'] && phone_numbers)) The problem I'm having is that

Unique multiple column in EF6 codefirst

假如想象 提交于 2019-12-10 15:45:29
问题 I have a class Email that looks like : public class Email { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public string Subject { get; set; } public string Body { get; set; } public string From { get; set; } public DateTime SentOn { get; set; } public List<string> To { get; set; } } To ensure uniqueness I made a compound key on Subject , From and SentOn This created the problem that when Subject excess 128 characters, validation fails. So I just put a

Cassandra 1.1 composite keys / columns and hierarchical queries

点点圈 提交于 2019-12-07 18:23:46
问题 So far, this is what I understand of the current Cassandra architecture: Super columns are not desirable any more due to performance issues. Composite columns (actually keys) are a good choice for indexing hierarchical keys. Composite columns store nested components in sorted order. There is no actual index. I have some questions: Is everything I stated correct? Can composite columns efficiently process range queries per component (assuming logical usage)? Are composite columns suited to

How can I programmatically determine which Datastore indexes are in error?

怎甘沉沦 提交于 2019-12-07 12:59:51
问题 When I run update_indexes on Google Datastore I get the message below. It is telling me to determine which indexes are in error by looking at the GUI, then delete these indexes. I have 51 erroneous indexes out of 200, and copying them out of the GUI is not feasible. (Edit: By laboriously removing and adding indexes from the datastore-indexes.xml, we identified the one problematic index.) Good devops procedure demands that we do this sort of thing automatically. How does one determine which