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
3 answers

Can MySQL use index in a RANGE QUERY with ORDER BY?

I have a MySQL table: CREATE TABLE mytable ( id INT NOT NULL AUTO_INCREMENT, other_id INT NOT NULL, expiration_datetime DATETIME, score INT, PRIMARY KEY (id) ) I need to run query in the form of: SELECT * FROM…
Continuation
  • 12,722
  • 20
  • 82
  • 106
9
votes
1 answer

Postgres chooses much slower Seq Scan instead of Index Scan

I started by ensuring the planner had updated stats: my_db=> vacuum analyze; VACUUM Time: 1401.958 ms When only selecting foos.bar_id, the query executes fine with an Index Only Scan on that column: my_db=> EXPLAIN ANALYZE SELECT foos.bar_id FROM…
rcrogers
  • 2,281
  • 1
  • 17
  • 14
9
votes
3 answers

Numpy blockwise reduce operations

I consider myself an experienced numpy user, but im not able to find a solution for the following problem. Assume there are the following arrays: # sorted array of times t = numpy.cumsum(numpy.random.random(size = 100)) # some values associated…
Marti Nito
  • 697
  • 5
  • 17
9
votes
1 answer

Best possible ways to disable index before insert operation and enable back Index after insert

I'm planning to create a Non-clustered columnstore index on SQL Server 2014. But non clustered column store index is read-only and cannot perform DML operations, we need to disable before insert and enable back after insert. What are the best…
Jay Nani
  • 105
  • 1
  • 1
  • 6
9
votes
1 answer

Python, tuple indices must be integers, not tuple?

So, I'm not entirely sure what's going on here, but for whatever reason Python is throwing this at me. For reference, it's part of a small neural network I'm building for fun, but it uses a lot of np.array and such, so there's a lot of matrices…
Scorch
  • 437
  • 1
  • 3
  • 14
9
votes
1 answer

querying panda df to filter rows where a column is not Nan

I am new to python and using pandas. I want to query a dataframe and filter the rows where one of the columns is not NaN. I have tried: a=dictionarydf.label.isnull() but a is populated with true or false. Tried this…
DileepGogula
  • 331
  • 5
  • 20
9
votes
2 answers

Error iterating through a Pandas series

When I get the first and second elements of this series, it works OK, but from element 3 onwards, giving an error when I try to fetch. type(X_test_raw) Out[51]: pandas.core.series.Series len(X_test_raw) Out[52]: 1393 X_test_raw[0] Out[45]: 'Go…
Sarang Manjrekar
  • 1,839
  • 5
  • 31
  • 61
9
votes
2 answers

Pandas groupby object filtering

i have a pandas dataframe df.columns Index([u’car_id’,u’color’,u’make’,u’year’)] I would like to create a new FILTERABLE object that has the count of each group (color,make,year); grp =…
chattrat423
  • 603
  • 2
  • 11
  • 24
9
votes
1 answer

How do I update elements of a tensor using indices?

I'm looking for an "update" function that takes in a tensor t1, some indices and values and returns a new tensor t2, which is t1 but with the values at the indices changed accordingly. This seems like the most basic of functions, but I do not see it…
zenna
  • 9,006
  • 12
  • 73
  • 101
9
votes
4 answers

Create sql indexes for complex filtering

There is table in sql database human. I have ui for this table and filter form like this: I can set only some values (for instance age and state only). If filter item is not specified it won't be add to sql WHERE condition. WHERE condition is…
mtkachenko
  • 5,389
  • 9
  • 38
  • 68
9
votes
4 answers

How to handle very frequent updates to a Lucene index

I am trying to prototype an indexing/search application which uses very volatile indexing data sources (forums, social networks etc), here are some of the performance requirements, Very fast turn-around time (by this I mean that any new data (such…
fsm
  • 407
  • 2
  • 7
  • 19
9
votes
2 answers

How can I select data from a dask dataframe by a list of indices?

I want to select rows from a dask dataframe based on a list of indices. How can I do that? Example: Let's say, I have the following dask dataframe. dict_ = {'A':[1,2,3,4,5,6,7], 'B':[2,3,4,5,6,7,8], 'index':['x1', 'a2', 'x3', 'c4', 'x5', 'y6',…
Arco Bast
  • 3,595
  • 2
  • 26
  • 53
9
votes
2 answers

MySQL index for MIN and MAX

Could anyone clarify this point from the official MySQL documentation Indexes are used ... To find the MIN() or MAX() value for a specific indexed column key_col. This is optimized by a preprocessor that checks whether you are using WHERE…
super.t
  • 2,526
  • 7
  • 32
  • 51
9
votes
1 answer

pandas multi-index how to mask the data by the second level

I have a data-frame with multi-index like this: Date Period Value \n 20130101 0 12 \n 20130101 1 13 20130102 0 13 20130102 1 14 The first level is Date and the second level is period. I would…
motam79
  • 3,542
  • 5
  • 34
  • 60
9
votes
3 answers

Accessing an array element when returning from a function

Some searching through Google (and my own experience) shows that in PHP you can't grab an array element when it's been returned from a function call on the same line. For example, you can't do: echo getArray()[0]; However, I've come across a neat…
Daniel
  • 163
  • 3