A database structure that can improve the speed of queries at the cost of disk space and slower inserts/updates. It stores a copy of one or more columns but structures the data differently to allow for faster access.

learn more… | top users | synonyms (2)

0
votes
0answers
77 views

How could I improve speed of fetch in Oracle?

I've got a table of taxi GPS trajectory records with approx 60 million rows, including date, time, ID, longitude, latitude, speed, bearing etc., which were imported from .csv files with setting each ...
3
votes
1answer
47 views

Does updating a jsonb column trigger updates on all expression indexes on that column?

I am using the jsonb type in PostgreSQL. I frequently make updates of the following kind (where jdoc is a jsonb column): UPDATE my_table SET jdoc = jdoc || '{a: "Hello World!"}'::jsonb WHERE id = 123 ...
1
vote
1answer
36 views

Does creating a unique constraint on a Postgres column remove the need to index it?

Does creating a unique constraint on a Postgres column remove the need to index it? I expect that an index is automatically needed to maintain the constraint efficiently.
2
votes
2answers
55 views

Index for OR operator: a=x or b=x

I have table with three integer columns id, a and b. I want to get all records where a or b match specified parameter ordered by id: select id, a, b from t where a=x or b=x order by id Note that x ...
2
votes
2answers
56 views

Is there much difference between having a key (intA, intB), or having key (longAB) where longAB is the concatenation of bytes of intA and intB?

This is a bit of an odd question. Let's go with MySQL for example. I don't know a ton about db internals. Compare two scenarios, in one, we have a table with a composite key of the from (intA, intB)...
2
votes
1answer
26 views

How do I find what keys mysql will use for a query?

I just had a query encounter a deadlock, where the lock it was trying to acquire was for an index. But when I used explain to visualize the query, I saw that a different index was listed under key and ...
1
vote
1answer
32 views

Is it possible to have unique + null

I have a need to have a database table that has a column that is either null, or unique values. I know I can control that in code, but is there a way to do that with an index as a backup? Or is that ...
0
votes
1answer
34 views

Which columns to index with LEFT JOIN and GROUP_CONCAT

So i have a complicated MySQL search query, and I wonder which columns I need to index to speed up searching: SELECT wpp.ID, post_title, wp_terms.name AS category, wp_terms.slug AS slug, ...
2
votes
0answers
43 views

Postgres planner overerstimate index only scan

\d hits; Column | Type --------------+----------------------------- id | integer link_id | integer ...
3
votes
1answer
60 views

SELECT very slow when no results and a LIMIT is specified

I am running into an issue where a SELECT query is very slow because it does not use an index when the number of final results is 0 and a LIMIT clause is specified. If the number of results is ...
0
votes
0answers
56 views

Why my MySQL (myisam) index is broken and how to avoid it?

I have big composite (multiple-column) index on MySQL MyISAM table. And I noticed it doesn't work. I ran SHOW INDEX command. There are NULL in the Cardinality column on the most index fields (except ...
0
votes
1answer
47 views

MYSQL ORDER BY Performance

We have a query like this: SELECT PROJECT.PROJECTID, REQUEST.REQUESTID, SAMPLE.SAMPLEID,SAMPLE.OTHERSAMPLEID, ILLUMINASEQPROTOCOL2.SAMPLEID FROM ILLUMINASEQPROTOCOL2, PROJECT, SAMPLE, ...
0
votes
0answers
29 views

N-dimensional vectors in PostgreSQL Spatial Index

I have many 8-dimensional vectors. And I want to construct on them a R-tree ('USING gist' in PostgreSQL). But I have got stucked at the choice of the correct geometrical type. Whether the 'path' type ...
0
votes
0answers
54 views

Detect when a CREATE INDEX CONCURRENTLY is finished in PostgreSQL

If I create an index CONCURRENTLY in PostgreSQL, how can I see when it is finished? I am attempting to rebuild indexes to solve index bloat, and I need to keep the old index around for a while until ...
2
votes
1answer
74 views

Index columns with arithmetic operators

I commonly make this query on my database SELECT * FROM Example_tab WHERE Column_a + Column_b < 10;. Is it possible to create indexes based on Column_a + Column_b < 10 to speed up this lookup. ...
1
vote
1answer
32 views

InnoDB slow query (few derived and dependent queries)

I have a select query which always worked pretty fast but data kept increasing which is why this query became very slow (2/3mins). I need to get all 0 values from those tables in the last WHERE ...
0
votes
2answers
58 views

What is the minimum privilege required to create a full text index?

I just created a full text catalog on my database. I now have a developer who needs the ability to create full text indexes on the tables in this database. The suggestion given in a previous ...
0
votes
1answer
34 views

Query not using indexes

I have a query which is not using the timestamp index and scanning 200 million records. I know that the query will not use the index if there is a function applied on top of it. However is there any ...
1
vote
3answers
80 views

Is having Estimated number of Rows > Actual Number of Rows an issue to worry about?

I've a table [order] where a simple select shows cardinal difference between Estimated Number of Rows and Actual Number of Rows and in a strange way. Generally Estimated Number of Rows skews as ...
2
votes
2answers
94 views

How do I get the DDL used to create function based index?

I am reverse-engineering the schema of an Oracle database. I have a table and I created a function-based index on it. DROP TABLE Fbi_tab; CREATE TABLE Fbi_tab ( a INTEGER, b INTEGER, c ...
1
vote
2answers
56 views

What is the ideal composite index for this query?

What is the ideal Composite Index in MySQL for the following query on an InnoDB Table1? SELECT ColA FROM Table1 WHERE ColB = 0 AND ColC = 0 AND ColD = 0 ColA is the left-most Primary Key. ColB ...
1
vote
1answer
48 views

PostgreSQL not using partial index when using boolean in WHERE clause

I'm trying to create a partial index which includes rows based on a boolean value but in my tests neither rows with the value set to TRUE or FALSE are included in the index, or at least the index isn'...
2
votes
1answer
55 views

How to start indexing a new data warehouse

I am building a data warehouse (SQL Server 2012, Kimball Dimensional modeling, 750GB) that will supply data to reports (SSRS), cubes (SSAS) and various datafeeds. I plan to use an index tuning tool (...
11
votes
1answer
314 views

Execution plan with multiple missing indexes

If you run a query with 'Include Actual execution plan' the plan will also suggest indexes which are missing. The index details are inside MissingIndexes tag in the XML. Is there a situation when the ...
0
votes
1answer
62 views

Preventing MySQL index corruption

I'm having a recurring issue with a MySQL database where one index in particular has been getting corrupted. Originally I saw a corruption event about every 2-3 weeks and this week I've seen it happen ...
3
votes
1answer
83 views

Index fragmentation increased significantly after rebuild

I've googled this and I know that some people say index fragmentation doesn't matter, but they go on to describe scenarios where it might matter. Mine might be such a scenario. I have an index on a ...
3
votes
1answer
129 views

Speeding up a GROUP BY, HAVING COUNT query

I'm trying to speed up this query in Postgres 9.4: SELECT "groupingsFrameHash", COUNT(*) AS nb FROM "public"."zrac_c1e350bb-a7fc-4f6b-9f49-92dfd1873876" GROUP BY "groupingsFrameHash" HAVING COUNT(*) &...
0
votes
0answers
34 views

Weird single-column “key” index in mysql

I am running MySQL 5.5.47-0+deb7u1-log (Debian). In a database I have two tables with exactly the same structure, roughly the same data (don't ask me why, its a long story..., and I know they are ...
1
vote
1answer
119 views

Postgresql 9.5 BRIN index dramatically slower than expected

I have a table with over 12 million rows of log data and have migrated to Postgres 9.5 to take advantage of the new BRIN index because I have disk space limitations. I assumed that my situation was ...
0
votes
1answer
66 views

Query bytea column using prefix

Assuming I have a table with a bytea column called data on a table called t, how can I: Write a query that returns all rows which have a specific prefix on their data column. Index the query. I am ...
0
votes
1answer
66 views

If I query records matching some value, why does InnoDB examine most of the records that had that value once, but have changed since then?

We have an issue with MySQL InnoDB performance. We insert records into a table with a status field value of zero, these records need to be processed by another task. When this another task starts ...
7
votes
1answer
108 views

Index SEEK is not used unless OPTION (RECOMPILE)?

(Question moved from SO) I have a table (dummy data) with clustered index contains 2 columns : Now I run those two queries : declare @productid int =1 , @priceid int = 1 SELECT productid,...
1
vote
1answer
24 views

Postgres odd behavior with indices

I've got a datavalue table with ~200M rows or so, with indices on both site_id and paramter_id. I need to execute queries like "return all sites with data" and "return all parameters with data". The ...
2
votes
2answers
175 views

Clustered Index Creation

I have been trying to create a clustered index on a table which is 1.4 TB in size. This is my query: CREATE CLUSTERED INDEX [C_IDX_Impressions] ON [dbo].[Impressions] ( [User_ID] ASC ) WITH (...
4
votes
2answers
79 views

PostgreSQL ignoring (unique) index on TEXT field

I have a users table similar to CREATE TABLE users ( id bigserial NOT NULL, msisdn text NOT NULL ); and a UNIQUE constraint defined on msisdn: ALTER TABLE users ADD CONSTRAINT UNIQUE (msisdn); ...
1
vote
1answer
33 views

MySQL indexing issue when trying to search for a part of a string/word

What we're running into: Engine: MySQL. We've been working on a filter where an user can search for a reference number. However, we've ran into an issue with performance on bigger data sets. We ...
3
votes
1answer
64 views

Choosing good indexes for my queries

I have a table which looks like this: Messages table: Message_ID (BIGINT) PK auto_increment FromUser (INT 16) ToUser (INT 16) DateCreated (Timestamp) MessageText (Varchar (500) ) HasRead (TINYINT (0=...
10
votes
3answers
284 views

Field order in a composite index order with high selectivity and low selectivity fields

I have a SQL Server table with over 3 billion rows. One of my query takes an extremely long time so I am considering optimizing it. The query looks like this: SELECT [Enroll_Date] ,Count(*) AS [...
4
votes
2answers
77 views

Performance for MySQL InnoDB B+Tree index with many duplicate values

I'm trying to diagnose seemingly random performance issues with our database server. Below is a simplified scenario, hopefully generic enough to serve as a useful future reference for anyone looking ...
1
vote
1answer
113 views

How can I improve this table, and subsequently the performance of the queries I execute on it?

I have inherited this table of POS transaction level data. In my opinion it is terrible. There are 3.5 million rows, which span ~4 years, with a distribution of anywhere between 1 result and 100k ...
5
votes
2answers
176 views

Total billions of rows and daily millions of row insert: What database system suits best [closed]

We developed a system with very high volume of data but very simplified data structure. We had only cellX, cellY, timeStamp and value columns. Operations are: Insert 455+ thousand rows per day ...
3
votes
1answer
97 views

Using ILIKE with unaccent and with only right end wildcard

I use Postgresql 9.4 and I have a big table named foo. I want to search on it but I get long execution times if the search text is very short (e.g. "v") or long (e.g. "This is a search example with ...
6
votes
1answer
109 views

Index Allocation Maps

I am a developer reading the book "Querying Microsoft SQL Server 2012." I have come across the following diagram: Why are the pages in the first two rows of the diagram (row 1 starting: 1:174 and ...
1
vote
0answers
62 views

Cardinality of an index in a MySQL table is equal to table's row size

I have just included an index to a MyISAM table and the cardinality appears to be 1 million something which is exactly the number of rows in the table. In fact it needed to be 315 because distinct ...
2
votes
1answer
41 views

How do I recover my database after losing a tablespace with indexes?

I'm thinking of moving all the indexes in my PostgreSQL 9.3 database to a tablespace on an SSD for improved performance. This SSD is not in a RAID array and I need to consider a scenario where it ...
2
votes
2answers
339 views

SQL Server : Included columns in an Index: is there something like “too many”?

We have a table in one of our databases with approximately following structure: Field1 int primary key Field2 int foreign key A Field3 int foreign key B Field4 int foreign key C Field5 ... Field70 ...
0
votes
1answer
31 views

Splitting the table to get more clusterization options - will it help? [closed]

Complete theory. Let's assume we have a table with a few millions rows. The table has clustered index over PK, and it is important for quick fetching of particular rows. However, the table also has a ...
3
votes
0answers
87 views

Sort operation SQL Server 2012

I am trying to optimize a query and the sort operation (91% cost) is the costliest operation. Any help will be appreciated. Query is : SELECT TOP 1 ArchiveType, CONVERT(NVARCHAR(30), A....
0
votes
1answer
61 views

Full text indexes on big tables

I have a news website where I store my articles in a table that looks like that: Id title data Where data contains the content of the article and is the biggest column in the database by far. ...
0
votes
1answer
28 views

How to create unique index for both cases

I have table in PostgreSQL with sender_id and receiver_id and a unique index: add_index :my_table, [:sender_id, :recipient_id], unique: true Table will created, if sender_id: 1, and recipient_id: 2....