Questions tagged [indexing]

Indexing data structures is a general technique to improve the speed of data lookups.

The purpose of storing an index is to optimize speed and performance in finding relevant documents for a search query. Without an index, the search process would scan every document in the corpus, which would require considerable time and computing power.

Indexes may benefit both read queries and updates. Many people wrongly believe indexes are only good for read queries. In general, there are three methods of indexing - non-clustered, clustered and cluster.

References:

Top Indexing Questions

By these questions, you will clear your concepts regarding indexing. And you can ask similar questions (not duplicate) with this tag.

33955 questions
9
votes
4 answers

Unsigned versus signed numbers as indexes

Whats the rationale for using signed numbers as indexes in .Net? In Python, you can index from the end of an array by sending negative numbers, but this is not the case in .Net. It's not easy for .Net to add such a feature later as it could break…
simendsjo
  • 4,739
  • 2
  • 25
  • 53
9
votes
1 answer

Strange behavior of tuple indexing a numpy array

I noticed some confusing behavior when indexing a flat numpy array with a list of tuples (using python 2.7.8 and numpy 1.9.1). My guess is that this is related to the maximum number of array dimensions (which I believe is 32), but I haven't been…
kadrlica
  • 322
  • 3
  • 15
9
votes
9 answers

Cannot achieve a cover index with this table (2 equalities and one selection)?

CREATE TABLE `discount_base` ( `id` varchar(12) COLLATE utf8_unicode_ci NOT NULL, `amount` decimal(13,4) NOT NULL, `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `family` varchar(4) COLLATE utf8_unicode_ci NOT NULL, …
gremo
  • 47,186
  • 75
  • 257
  • 421
9
votes
4 answers

Getting Hibernate to generate indexes on foreign keys

I am using Hibernate 3.3.2 in a fairly large project with PostgreSQL 8.4 using the PostgreSQLDialect. The way we have our relationships set up, we end up doing a lot of searching on the Foreign Key attributes of our tables. For performance…
biggusjimmus
  • 2,706
  • 3
  • 26
  • 31
9
votes
4 answers

Indexing documents using Solr results in Expected mime type application/octet-stream but got text/html

What I am trying to do is to index document using Solr. I have installed and started Solr server on a Windows environment and I am trying to index using SolrJ. However when I try to add the solr document to the server as shown below it results in…
Abdelrahman Shoman
  • 2,882
  • 7
  • 36
  • 61
9
votes
1 answer

Localized index for UITableView

I'm trying to use a localized index for my UITableView same as iPhone's Contacts application . here is how I return an array of characters: - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { return…
Mehrdad M
  • 171
  • 2
  • 7
9
votes
8 answers

Is adding indexes to a SQL Server ever a bad idea?

We have a mid-size SQL Server based application that has no indexes defined. Not even on the the identity columns. I suggested to our moderately expensive application consultant that perhaps we might get better performance (particularly as our…
Aerik
  • 2,307
  • 1
  • 27
  • 39
9
votes
2 answers

Elasticsearch index much larger than the actual size of the logs it indexed?

I noticed that elasticsearch consumed over 30GB of disk space over night. By comparison the total size of all the logs I wanted to index is only 5 GB...Well, not even that really, probably more like 2.5-3GB. Is there any reason for this and is there…
Christopher Bruce
  • 661
  • 3
  • 10
  • 24
9
votes
3 answers

Array.Find and IndexOf for multiple elements that are exactly the same object

I have trouble of getting index of the current element for multiple elements that are exactly the same object: $b = "A","D","B","D","C","E","D","F" $b | ? { $_ -contains "D" } Alternative version: $b =…
ALIENQuake
  • 520
  • 3
  • 12
  • 28
9
votes
1 answer

How to retrieve older version document from elasticsearch?

Is there any way to retrieve older version of same document in elasticsearch? Suppose I've indexed 1 document in ES: put class/student/1 { "marks":95 } Later point of time I want to update it to: put class/student/1 { "marks":96 …
Satish
  • 2,478
  • 2
  • 17
  • 22
9
votes
2 answers

How does numpy order array slice indices?

I have an np.array data of shape (28,8,20), and I only need certain entries from it, so I'm taking a slice: In [41]: index = np.array([ 5, 6, 7, 8, 9, 10, 11, 17, 18, 19]) In [42]: extract = data[:,:,index] In [43]: extract.shape Out[43]: (28,…
Zak
  • 3,063
  • 3
  • 23
  • 30
9
votes
1 answer

Postgres uses wrong index

I've got a query: EXPLAIN ANALYZE SELECT CAST(DATE(associationtime) AS text) AS date , cast(SUM(extract(epoch FROM disassociationtime) - extract(epoch FROM…
Tony
  • 3,605
  • 14
  • 52
  • 84
9
votes
1 answer

How to apply the output of numpy.argpartition for 2-D Arrays?

I have a largish 2d numpy array, and I want to extract the lowest 10 elements of each row as well as their indexes. Since my array is largish, I would prefer not to sort the whole array. I heard about the argpartition() function, with which I can…
drevicko
  • 14,382
  • 15
  • 75
  • 97
9
votes
1 answer

Liquibase create indexes with functions

I have this database in postgresql which has this index: CREATE INDEX fav_alias_lower_index ON fav_alias USING hash((LOWER(fav_alias))); When I reversed engineered this database I got this liquibase changelog:
João Martins
  • 1,026
  • 2
  • 14
  • 35
9
votes
2 answers

text indexes vs integer indexes in mysql

I have always tried to have an integer primary key on a table no matter what. But now I am questioning if this is always necessary. Let's say I have a product table and each product has a globally unique SKU number - that would be a string of say…
user307927
  • 748
  • 9
  • 22