Ask a Question related to PostgreSQL / PGSQL, Design and Development.

  1. #1

    Default DB Slowing Down

    Hi,
    we have a database. not to big about 50 tables, 20m records. On a daily
    basis we update/insert/delete between 500k to 1M records in total. We
    run a full vacuum every night. The db grows probably by 200k records
    each day and at the end of the month it gets cleaned up.
    We run 7.4.1 and 7.4.6

    Now, after a few weeks the db starts to slow down after about 2 months
    same operations take 2-3 times as long as originally. The only way to
    speed it up again is to drop the entire database; run an initdb, create
    and restore the database.

    Is that an expected behavior?
    Any help or suggestions are appreciated.

    Thanks
    Alex


    ---------------------------(end of broadcast)---------------------------
    TIP 7: don't forget to increase your free space map settings

    Alex Guest

  2. Similar Questions and Discussions

    1. postgresql 7.4.6 slowing down
      I'm using Fedora Core 2, apache 2.0 and postgresql 7.4.6. Recently, the application is slowing down. When I check the process using "top",...
    2. Illustartor is slowing down,WHY?
      As I ad more filters to my project I am noticing that Illustrator 10 is slowing down. Why? I tried lowering the memory on Illustator 10 by doing...
    3. Itunes 4.0.1 slowing down
      Hi all! I am on OS X.2.6, iMac Combo 700mhz, use iTunes 4.0.1. My HD has 4 partitions, the one with OS X has iTunes on it, of course, the iTunes...
    4. ASP.NET application slowing down
      We have written an ASP.NET application in VB connecting to a SQL Server database. It is run across an internal network at a client site, with...
    5. Computer Slowing Down
      i had a problem with this once it was due to my virus scanner,(and the computer was a little old) but once the virus scanner was removed it was all...
  3. #2

    Default Re: DB Slowing Down

    Alex wrote:
    > Hi,
    > we have a database. not to big about 50 tables, 20m records. On a daily
    > basis we update/insert/delete between 500k to 1M records in total. We
    > run a full vacuum every night. The db grows probably by 200k records
    > each day and at the end of the month it gets cleaned up.
    > We run 7.4.1 and 7.4.6
    >
    > Now, after a few weeks the db starts to slow down after about 2 months
    > same operations take 2-3 times as long as originally. The only way to
    > speed it up again is to drop the entire database; run an initdb, create
    > and restore the database.
    Information, Alex, information.
    Can you give a specific example of where a query gets slower?
    Is this a gradual effect or sudden?
    Do you know if your indexes are growing unexpectedly? (shouldn't be, but
    worth keeping an eye on)
    Are you happy PG is tuned

    --
    Richard Huxton
    Archonet Ltd

    ---------------------------(end of broadcast)---------------------------
    TIP 3: if posting/reading through Usenet, please send an appropriate
    subscribe-nomail command to [email]majordomo@postgresql.org[/email] so that your
    message can get through to the mailing list cleanly

    Richard Huxton Guest

  4. #3

    Default Re: DB Slowing Down

    It a gradual process. For example, we have 3 reference tables that get
    updated very day. they have between 3,5 and 7M records. All we do is
    simple inserts, deletes. The number of records is different each day so
    its a bit difficult to say.
    Another table is a price database. This is where we actually see the
    biggest difference. The 2 tables have about 2M records each, each day we
    add about 60-80k records and update about the same number. At the end of
    the day about 80% of these will be removed. So the tables grow by 500k
    records a month, but at the end of the month again we remove about
    300-400k of these records. What we see is that this load of 60-80
    records at the beginning of a month and after re creating the db takes
    in the are of 8min or so. after 2-3 month the whole process will take up
    to 20-25 minutes. even though the two tables have only grown max. 500k.
    Even the cleanup at the end of the month does not help a lot. it speeds
    things up but nowhere close to what it would be after recreating the db.

    Alex

    Richard Huxton wrote:
    > Alex wrote:
    >
    >> Hi,
    >> we have a database. not to big about 50 tables, 20m records. On a
    >> daily basis we update/insert/delete between 500k to 1M records in
    >> total. We run a full vacuum every night. The db grows probably by
    >> 200k records each day and at the end of the month it gets cleaned up.
    >> We run 7.4.1 and 7.4.6
    >>
    >> Now, after a few weeks the db starts to slow down after about 2
    >> months same operations take 2-3 times as long as originally. The only
    >> way to speed it up again is to drop the entire database; run an
    >> initdb, create and restore the database.
    >
    >
    > Information, Alex, information.
    > Can you give a specific example of where a query gets slower?
    > Is this a gradual effect or sudden?
    > Do you know if your indexes are growing unexpectedly? (shouldn't be,
    > but worth keeping an eye on)
    > Are you happy PG is tuned
    >


    ---------------------------(end of broadcast)---------------------------
    TIP 5: Have you checked our extensive FAQ?

    [url]http://www.postgresql.org/docs/faqs/FAQ.html[/url]

    Alex Guest

  5. #4

    Default Re: DB Slowing Down

    Alex wrote:
    > It a gradual process. For example, we have 3 reference tables that get
    > updated very day. they have between 3,5 and 7M records. All we do is
    > simple inserts, deletes. The number of records is different each day so
    > its a bit difficult to say.
    > Another table is a price database. This is where we actually see the
    > biggest difference. The 2 tables have about 2M records each, each day we
    > add about 60-80k records and update about the same number. At the end of
    > the day about 80% of these will be removed. So the tables grow by 500k
    > records a month, but at the end of the month again we remove about
    > 300-400k of these records. What we see is that this load of 60-80
    > records at the beginning of a month and after re creating the db takes
    > in the are of 8min or so. after 2-3 month the whole process will take up
    > to 20-25 minutes. even though the two tables have only grown max. 500k.
    > Even the cleanup at the end of the month does not help a lot. it speeds
    > things up but nowhere close to what it would be after recreating the db.
    Well, if you're not getting index bloat (and I don't think you should be
    in 7.4.x) then that suggests you're doing a VACUUM not VACUUM FULL (and
    don't have enough free-space-map allocated. Try adding a VERBOSE to your
    VACUUMs and see what figures come out, and check the manuals for the
    fsm... settings.

    Alternatively, it could be that the physical order of records is better
    when you dump/restore. It might be looking into what CLUSTER might do
    for you if run overnight.

    Basically, it sounds like one of 3 things:
    1. The indexes are continually growing. (REINDEX)
    2. Increasing numbers of "gaps" in the tables due to updates/deletes.
    (VACUUM)
    3. The dump/restore puts the data in a useful physical ordering which
    gets shuffled as you update. (CLUSTER)

    --
    Richard Huxton
    Archonet Ltd

    ---------------------------(end of broadcast)---------------------------
    TIP 7: don't forget to increase your free space map settings

    Richard Huxton Guest

  6. #5

    Default Re: DB Slowing Down

    Thanks for the suggestions.
    I run a vaccum analyze every night. I will look into all the options you
    suggested.

    Thanks
    Alex

    Richard Huxton wrote:
    > Alex wrote:
    >
    >> It a gradual process. For example, we have 3 reference tables that
    >> get updated very day. they have between 3,5 and 7M records. All we
    >> do is simple inserts, deletes. The number of records is different
    >> each day so its a bit difficult to say.
    >> Another table is a price database. This is where we actually see the
    >> biggest difference. The 2 tables have about 2M records each, each day
    >> we add about 60-80k records and update about the same number. At the
    >> end of the day about 80% of these will be removed. So the tables grow
    >> by 500k records a month, but at the end of the month again we remove
    >> about 300-400k of these records. What we see is that this load of
    >> 60-80 records at the beginning of a month and after re creating the
    >> db takes in the are of 8min or so. after 2-3 month the whole process
    >> will take up to 20-25 minutes. even though the two tables have only
    >> grown max. 500k. Even the cleanup at the end of the month does not
    >> help a lot. it speeds things up but nowhere close to what it would be
    >> after recreating the db.
    >
    >
    > Well, if you're not getting index bloat (and I don't think you should
    > be in 7.4.x) then that suggests you're doing a VACUUM not VACUUM FULL
    > (and don't have enough free-space-map allocated. Try adding a VERBOSE
    > to your VACUUMs and see what figures come out, and check the manuals
    > for the fsm... settings.
    >
    > Alternatively, it could be that the physical order of records is
    > better when you dump/restore. It might be looking into what CLUSTER
    > might do for you if run overnight.
    >
    > Basically, it sounds like one of 3 things:
    > 1. The indexes are continually growing. (REINDEX)
    > 2. Increasing numbers of "gaps" in the tables due to updates/deletes.
    > (VACUUM)
    > 3. The dump/restore puts the data in a useful physical ordering which
    > gets shuffled as you update. (CLUSTER)
    >
    > --
    > Richard Huxton
    > Archonet Ltd
    >
    >


    ---------------------------(end of broadcast)---------------------------
    TIP 7: don't forget to increase your free space map settings

    Alex Guest

  7. #6

    Default Re: DB Slowing Down

    Alex wrote:
    > Thanks for the suggestions.
    > I run a vaccum analyze every night. I will look into all the options you
    > suggested.
    And please post back your results as there are others who are interested
    in this thread. :)

    --
    Until later, Geoffrey

    ---------------------------(end of broadcast)---------------------------
    TIP 1: subscribe and unsubscribe commands go to [email]majordomo@postgresql.org[/email]

    Geoffrey Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139