Skip to content

PostgreSQL tuning #3

Closed
Closed
@jdavid

Description

@jdavid

PostgreSQL is becoming slow as it grows.

I've made these changes to the configuration:

  • Increased shared_buffers to 1GB, from 512MB
  • Reduced random_page_cost to 1.0, from 4.0 (this change increases the chances the planner will prefer the index over a sequential scan)

With these changes the query (found in the logs), goes from 4 minutes to 3 seconds.

SELECT time, bat as battery
FROM wsn_frame JOIN wsn_metadata ON metadata_id = wsn_metadata.id
WHERE
          wsn_metadata.name IN('pf-Juvvass-4')
          AND bat IS NOT NULL
          AND time >= 1537286218 AND time <= 1552924618
ORDER BY time;

Regarding pf-Juvvass-4 I've found that it's slower than asking for other motes. The reason is that there're many metadatas with that name. So we should:

  • Merge the pf-Juvvass-4 and others in a similar situation. There're so many because I include the IP address in the metadata; the easy solution would be to drop that information.

The core idea here is to reduce the number of metadatas when possible.

However other queries are still slow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions