Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 2639

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 sorted but structures the data differently to allow faster access.

0 votes

Why index is not used after replacing "WHERE field=x" to "field in (x,y)"?

You have two things you can look at it. The Mona Lisa. A museum attendant that is pointing to the Mona Lisa. You can't look at them both at the same time. Which do you want to look at it? That's t …
Evan Carroll's user avatar
  • 64.6k
2 votes

postgres bloom index

Your indexing is totally irrelevant neither index is used (thus the <1% difference). Did you ANALYZE the table after you created the index? … I would expect the bloom index speed things up by massively reducing the size of the table you have to visit. …
Evan Carroll's user avatar
  • 64.6k
3 votes

Confused about indexing for IS NOT NULL

No, an index on IS NOT NULL has no need in itself to visit the table on queries restricted to IS NOT NULL or on queries which can be determined to be not-null. … In fact, on queries restricted to the column where the value IS NOT NULL, you could potentially be doing an INDEX ONLY SCAN which I demonstrate here. …
Evan Carroll's user avatar
  • 64.6k
2 votes
Accepted

Is it possible to create an empty or dummy index in postgres?

Command: DROP INDEX Description: remove an index Syntax: DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ] But yes, the DROP INDEX doesn't even know if the index is on … -- DROP INDEX foo_x_idx; DROP INDEX
Evan Carroll's user avatar
  • 64.6k
0 votes
Accepted

multi-column index has 1 unique column vs single column

I would suggest both, Making comment_id a PRIMARY KEY: which is both UNIQUE and NOT NULL If shop_name is frequently a part of the query, making shop_name it's own index. …
Evan Carroll's user avatar
  • 64.6k
1 vote
Accepted

Generic way to determine if the table needs index (PostgreSQL)

So you're working at the problem from the wrong angle, the right question isn't Are all of those factors correct to create an index? But instead, For this given query, can I use an index? … That is to say, go ahead and create the index. …
Evan Carroll's user avatar
  • 64.6k
3 votes
Accepted

Do indexes on primary keys default to fillfactor of 90%, and should they be set to 100%?

The index works the same way. … The question is after the pages are properly sized for the index, how much extra-space on those pages should be left for future operations? …
Evan Carroll's user avatar
  • 64.6k
1 vote
Accepted

Why isn't my Postgres index being used?

Install pg_trgm, CREATE extention pg_trgm; Create either a gist or gin index. … CREATE index test_trgm_gin ON test USING gin (some_text gin_trgm_ops); CREATE index test_trgm_gist ON test USING gist (some_text gist_trgm_ops); See this blog post on depesz for more information. …
Evan Carroll's user avatar
  • 64.6k
0 votes

Indexing a string by a subset of its characters (i.e.: the Kanji ones)

At present, I am using a script external to the database to generate the entries_kanji table by iterating over every row in entries, extracting the kanji from each keyword and inserting a row into …
Evan Carroll's user avatar
  • 64.6k
1 vote
Accepted

Index for inequality on multiple columns (col1 >= 'const_1' AND col2 <= 'const_2')

create index plane_tracks_on_created_at on plane_tracks(created_at); create index plane_tracks_on_updated_at on plane_tracks(updated_at); create index plane_tracks_on_created_at_updated_at on plane_tracks … to another compound index. …
Evan Carroll's user avatar
  • 64.6k
1 vote

Improve execution time of query in PostgreSQL with multiple joins

Try going with an EXISTS test. First, let's be explicit about where the columns are coming from, also you don't need col = TRUE and col = FALSE on bools. You can simply say WHERE col or WHERE NOT col, …
Evan Carroll's user avatar
  • 64.6k
18 votes
Accepted

Does PostgreSQL index null values?

Since at least PostgreSQL 8.3, PostgreSQL indexes NULL using a bitmap on the index. That means "yes" it's indexed. Except it takes a bit, rather than a byte[s]. …
Evan Carroll's user avatar
  • 64.6k
0 votes

Text index using text_pattern_ops with utf-8 vs. default operator class with C?

And dropping the default btree index. Does the text_pattern_ops perform better/worse than the default with C? …
Evan Carroll's user avatar
  • 64.6k
0 votes

How many B-tree indexes do I need to support lookups by any subset of n columns?

They'll all result in index scans. … a sequential table scan over using the index. …
Evan Carroll's user avatar
  • 64.6k
4 votes

Do covering indexes in PostgreSQL help JOIN columns?

Will the index be used as a covering index to help the JOIN in the above query? Should I change my index writing strategy to cover foreign key columns? Not likely in the above query. … though this is a lot of work, I suggest starting off with CREATE INDEX ON table2 (t1); CREATE INDEX ON table2 (t2c1); And optimizing only if that isn't sufficient. …
Evan Carroll's user avatar
  • 64.6k

1
2 3 4 5
15 30 50 per page