Skip to main content

All Questions

1 vote
0 answers
67 views

Efficiently counting rows by date, adjusted for timezone

I have a table with a schema that looks like this: id (uuid; pk) timestamp (timestamp) category (bpchar) flaged_as_spam (bool) flagged_as_bot (bool) ... (other metadata) I have an index on this table ...
mattbasta's user avatar
  • 13.7k
0 votes
0 answers
2k views

EXPLAIN (BUFFER,ANALYZE) understading

I am using PostgreSQL 9.3 Can some one help me what i can do to improve this. The max number of records in db table is approx 5000 to 7000 varies daily basis. shared_buffers setting in PGsql DB is =...
Mak's user avatar
  • 139
-2 votes
1 answer
40 views

Poor performing postgres sql

Here's my sql, followed by the explanation. I need to improve the performance. Any ideas? PostgreSQL 9.3.12 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4, 64-bit ...
bopritchard's user avatar
1 vote
2 answers
3k views

Postgres not using index for range query in partitioned table

I found that Postgres is not using an index for a range query on a partitioned table. The parent table and its partitions have their date column indexed using btree. A query like this: select * ...
hudarsono's user avatar
  • 389
2 votes
2 answers
3k views

Optimizing SQL query with multiple joins and grouping (Postgres 9.3)

I've browsed around some other posts and managed to make my queries run a bit faster. However, I've come to a loss as to how to further optimize this query. I'm going to be using it on a website where ...
andrewjdg's user avatar
0 votes
3 answers
76 views

Slow query on a large table when using order by

I have a table with ~30M tuples. The table looks like: id | first_name | last_name | email ----------------------------------------- 1 | foo | bar | [email protected] Also there are an index (...
Victor's user avatar
  • 5,131
6 votes
1 answer
4k views

Partition pruning based on check constraint not working as expected

Why is the table "events_201504" included in the query plan below? Based on my query and the check constraint on that table I would expect the query planner to be able to prune it entirely: database=#...
jph's user avatar
  • 2,243
2 votes
1 answer
3k views

most impactful Postgres settings to tweak when host has lots of free RAM

My employer runs Postgres on a decently "large" VM. It is currently configured with 24 cores and 128 GB physical RAM. Our monitoring solution indicates that the Postgres processes never consume more ...
jph's user avatar
  • 2,243
4 votes
4 answers
3k views

Postgresql ignoring index on timestamp column even if query is faster using index

On postgresql 9.3, I have a table with a little over a million records, the table was created as: CREATE TABLE entradas ( id serial NOT NULL, uname text, contenido text, fecha date, hora time ...
plablo09's user avatar
  • 363