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
1 answer

MySQL: UNIQUE constraint without index

Is it possible to add a constraint like ALTER TABLE `t1` ADD UNIQUE(`col1`, `col2`); without creating an index? The index wouldn't be used for any queries so it would be a waste of space. It wouldn't be a problem if inserts and updates would be…
9
votes
2 answers

Oracle: Single multicolumn index or two single column indexes

I have table create table1( column1 number(10, column2 number(10), column3 number(10) ); column1 is Primary Key column2 and column3 is Foreign key I have created unique constraint on 2 columns alter table table1 add constraint…
user2824874
  • 199
  • 2
  • 5
  • 13
9
votes
5 answers

Should I create indexes on tinyint field types in mysql tables?

I was just working on a web application and find that the most the mysql tables have fields, like, is_live, can_do, required, published (and many more) having field type TINYINT, and takes either 0 or 1 only. I was just wondering if I need to create…
user187580
  • 2,275
  • 11
  • 32
  • 39
9
votes
5 answers

JavaScript find li index within ul

I'm trying to find the index of my list item by id in Javascript. For example I have list of 5 items and given an element I want to figure out which position it is in the list. Below is the code that I hope to build on. It's using an onclick…
Dan Rasmuson
  • 5,705
  • 5
  • 29
  • 45
9
votes
2 answers

How can I find listbox item index with item value?

my MessageBox.Show(listbox.Items[0].ToString()); is "abber" how can I find listbox item index 0 with "abber"?
nazim corakli
  • 197
  • 1
  • 3
  • 8
9
votes
1 answer

index a Python Pandas dataframe with multiple conditions SQL like where statement

I am experienced in R and new to Python Pandas. I am trying to index a DataFrame to retrieve rows that meet a set of several logical conditions - much like the "where" statement of SQL. I know how to do this in R with dataframes (and with R's…
user2537610
9
votes
1 answer

Facet for counting index and type hits in elasticsearch

I'm using the query below to find the word "developer" in a blog index... http://localhost:9200/blog/_search { "query": { "query_string": { "query": "developer" } } } The query returns 3 hits on user and 1 hit on post…
raffian
  • 31,267
  • 26
  • 103
  • 174
9
votes
1 answer

Linq to SQL nvarchar problem

I have discovered a huge performance problem in Linq to SQL. When selecting from a table using strings, the parameters passed to sql server are always nvarchar, even when the sql table is a varchar. This results in table scans instead of seeks, a…
Craig
  • 228
  • 1
  • 3
  • 7
9
votes
5 answers

Oracle query using 'like' on indexed number column, poor performance

On Query 1 a full table scan is being performed even though the id is an indexed column. Query 2 achieves the same result but much faster. If Query 1 is run returning an indexed column then it returns quickly but if non-indexed columns are returned…
James Collins
  • 309
  • 1
  • 2
  • 10
9
votes
6 answers

how to structure an index for group by in Sql Server

The following simple query takes a very long time (several minutes) to execute. I have an index: create index IX on [fctWMAUA] (SourceSystemKey, AsAtDateKey) SELECT MAX([t0].[AsAtDateKey]) AS [Date], [t0].[SourceSystemKey] AS [SourceSystem] FROM…
Craig
  • 228
  • 1
  • 3
  • 7
9
votes
4 answers

How to get element's index by xpath?

I've next structure :
aaa
bbb
...
jjj
I was wonder if there is a ways to use XPath, and to write some query were I can get the index of…
Igal
  • 4,603
  • 14
  • 41
  • 66
9
votes
3 answers

Do indexes count towards the 10gb database size limit on SQL Server Express?

I'm working on a project that uses a SQL Server Express database that is decently large already and I know indexing specific columns / tables can take up quite a bit of space. What I don't know is whether the space used by the index counts against…
PorcupineRending
  • 1,245
  • 1
  • 11
  • 16
9
votes
4 answers

PostgreSQL index not used for query on IP ranges

I'm using PostgreSQL 9.2 and have a table of IP ranges. Here's the SQL: CREATE TABLE ips ( id serial NOT NULL, begin_ip_num bigint, end_ip_num bigint, country_name character varying(255), CONSTRAINT ips_pkey PRIMARY KEY (id ) ) I've added…
Zain Zafar
  • 507
  • 2
  • 5
  • 19
9
votes
1 answer

How do I search an array using a partial string, and return the index?

I want to search through an array using a partial string, and then get the index where that string is found. For example: a = ["This is line 1", "We have line 2 here", "and finally line 3", "potato"] a.index("potato") # this returns 3 a.index("We…
user1976679
  • 93
  • 1
  • 1
  • 3
9
votes
3 answers

Use savefig in Python with string and iterative index in the name

I need to use the "savefig" in Python to save the plot of each iteration of a while loop, and I want that the name i give to the figure contains a literal part and a numerical part. This one comes out from an array or is the number associated to the…
user1872346
  • 91
  • 1
  • 1
  • 2
1 2 3
99
100