Questions tagged [database-indexes]

An index contains keys built from one or more columns in the table, or view, and pointers that map to the storage location of the specified data.

An index contains keys built from one or more columns in the table, or view, and pointers that map to the storage location of the specified data.

References:

Top Questions related to Database Indexing

571 questions
8
votes
4 answers

Cannot remove an index from table in Rails 4 and PSQL 9.3

In my schema.rb I have the following line: add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree When I run \di in psql I get: Schema | Name | Type | Owner |…
8
votes
2 answers

Are POSIX' read() and write() system calls atomic?

I am trying to implement a database index based on the data structure (Blink tree) and algorithms suggested by Lehman and Yao in this paper. In page 2, the authors state that: The disk is partitioned in sections of fixed size (physical pages; in…
isekaijin
  • 19,076
  • 18
  • 85
  • 153
8
votes
1 answer

MySQL query by date with big inverval

I have big table with 22 millions records. I want to execute next query: select auto_alerts from alerts_stat where endDate > "2012-12-01" To improve performance I added BTREE index for endData field: CREATE INDEX endDate_index USING BTREE ON…
Taky
  • 5,284
  • 1
  • 20
  • 29
7
votes
1 answer

MySQL Optimization: EXPLAIN "Extra" column contains "Using Where"

So I always thought that seeing "Using Where" in the Extra column was a good thing. However, I was planning a brown bag lunch for my coworkers on intepreting EXPLAIN and now I'm not so sure. The MySQL doc says this in the notes about "Using…
Mike Sherov
  • 13,277
  • 8
  • 41
  • 62
7
votes
3 answers

Why would MySQL use index intersection instead of combined index?

From time to time I encounter a strange MySQL behavior. Let's assume I have indexes (type, rel, created), (type), (rel). The best choice for a query like this one: SELECT id FROM tbl WHERE rel = 3 AND type = 3 ORDER BY created; would be to use…
7
votes
2 answers

Creating indexes on columns where primary key or unique key constraints already present

I am currently learning indexes in Oracle. In Oracle documentation, following can be found : Although the database creates an index for you on a column with an integrity constraint, explicitly creating an index on such a column is…
Shailesh Pratapwar
  • 4,054
  • 3
  • 35
  • 46
7
votes
4 answers

How can I quickly detect and resolve SQL Server Index fragmentation for a database?

I've come across a situation where my database operations on many of my SQL Server database's tables have become very slow as more records have been added (5s for single insert to a table with 1 million records). I've estimated that this may be due…
7
votes
1 answer

Do indexes make db updates slower?

It is usually said when you create indexes, it makes fetches faster for you but on the same time they slow down your updates (delete,insert,update) as with every update indexes are to be recreated. I have a question in my mind: if database updates…
faisalbhagat
  • 2,142
  • 24
  • 27
7
votes
1 answer

mysql - how to run query without index

I am looking to compare indexes and further optimize my code. What I would like to do is force the query to run without an index so I can see what difference it has made. Is it possible to do this?
Robbo_UK
  • 11,351
  • 25
  • 81
  • 117
6
votes
1 answer

Why PostgresQL count is so slow even with Index Only Scan

I have a simple count query that can use Index Only Scan, but it still take so long in PostgresQL! I have a cars table with 2 columns type bigint and active boolean, I also have a multi-column index on those columns CREATE TABLE cars ( id BIGSERIAL…
6
votes
4 answers

How to remove index varchar_pattern_ops in a django (1.8) migration?

When creating a model with a models.varchar(...) field, a varchar_pattern_ops index is being created. This is the table generated in postgresql Table "public.logger_btilog" Column | Type | Modifiers…
jperelli
  • 6,988
  • 5
  • 50
  • 85
6
votes
2 answers

Do non-clustered indexes slow down inserts?

I'm working in Sql Server 2005. I have an event log table that tracks user actions, and I want to make sure that inserts into the table are as fast as possible. Currently the table doesn't have any indexes. Does adding a single non-clustered index…
Mike Comstock
  • 6,640
  • 10
  • 36
  • 41
6
votes
6 answers

How can I speed up queries against tables I cannot add indexes to?

I access several tables remotely via DB Link. They are very normalized and the data in each is effective-dated. Of the millions of records in each table, only a subset of ~50k are current records. The tables are internally managed by a commercial…
aw crud
  • 8,791
  • 19
  • 71
  • 115
6
votes
2 answers

Cassandra 1.1 storage engine how does it store composites?

I'm trying to understand Cassandra's storage engine when it comes to composite columns. Unfortunately, the documentation I've read so far contains errors and is leaving me a bit blank. First, terminology. Composite columns comprise fully…
IamIC
  • 17,747
  • 20
  • 91
  • 154
6
votes
2 answers

What is the most optimal index for this delayed_job query on postgres?

delayed_job does a query like this regularly: SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE ((run_at <= '2012-05-23 15:16:43.180810' AND (locked_at IS NULL OR locked_at < '2012-05-23 11:16:43.180841') OR locked_by = 'host:foo pid:1') AND…
John Bachir
  • 22,495
  • 29
  • 154
  • 227
1 2
3
38 39