473,761 Members | 9,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Postgres memory usage

Hi:

Our postgres database has tables with several million rows in a server
running Red Hat 8.0 with 1GB of memory. Recently we are experiencing a
low performance in the access to the server via HTTP, after rebooting
the server the speed is the same.

I have noticed that available memory is aparently too low, according to top:

12:58pm up 1:28, 3 users, load average: 0,00, 0,01, 0,09
94 processes: 91 sleeping, 3 running, 0 zombie, 0 stopped
CPU states: 0,0% user, 0,0% system, 0,0% nice, 100,0% idle
Mem: 1031012K av, 1021440K used, 9572K free, 0K shrd, 62864K
buff
Swap: 2040244K av, 14960K used, 2025284K free 876808K
cached

Is it normal for Postgres to allocate almost all the memory in the computer?

Thanks in advance.
Ruben.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #1
3 4892

On Sep 16, 2004, at 8:58 AM, ru*****@supergu ai.com wrote:
I have noticed that available memory is aparently too low, according
to top:

12:58pm up 1:28, 3 users, load average: 0,00, 0,01, 0,09
94 processes: 91 sleeping, 3 running, 0 zombie, 0 stopped
CPU states: 0,0% user, 0,0% system, 0,0% nice, 100,0% idle
Mem: 1031012K av, 1021440K used, 9572K free, 0K shrd,
62864K
buff
Swap: 2040244K av, 14960K used, 2025284K free
876808K
cached


in the unix world, "free" memory is mostly useless because the OS will
give up various buffers it is using for caching if an app needs memory.
It is usually best to look at the output of free which will show you
how much of the memory is used by buffers & caches.

If that number is also low you should look to see how much memory your
applications are using.

Also, what are your shared_buffer and sort_mem settings set to in
postgresql.conf ?
Remember in Linux top will include how much shared memory an app has
touched in its SIZE. (But you can also look at the shared column to see
how much of hte size is shared)
..
--
Jeff Trout <je**@jefftrout .com>
http://www.jefftrout.com/
http://www.stuarthamm.net/
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #2
Thanks Jeff:

This is the output of free:

total used free shared buffers cached
Mem: 1031012 1018608 12404 0 64984 848160
-/+ buffers/cache: 105464 925548
Swap: 2040244 0 2040244

shared_buffers and sort_mem are both commented in postgresql.conf :

-bash-2.05b$ grep shared_buf data/postgresql.conf
#shared_buffers = 64 # 2*max_connectio ns, min 16
-bash-2.05b$ grep sort_m data/postgresql.conf
#sort_mem = 512 # min 32

I have verified that postgres is not the responsible for the low
performance of the system, but I just wanted to be sure that memory
usage is reasonable in a postgres installation.

Ruben.

Jeff wrote:

On Sep 16, 2004, at 8:58 AM, ru*****@supergu ai.com wrote:
I have noticed that available memory is aparently too low, according
to top:

12:58pm up 1:28, 3 users, load average: 0,00, 0,01, 0,09
94 processes: 91 sleeping, 3 running, 0 zombie, 0 stopped
CPU states: 0,0% user, 0,0% system, 0,0% nice, 100,0% idle
Mem: 1031012K av, 1021440K used, 9572K free, 0K shrd, 62864K
buff
Swap: 2040244K av, 14960K used, 2025284K free 876808K
cached


in the unix world, "free" memory is mostly useless because the OS will
give up various buffers it is using for caching if an app needs memory.
It is usually best to look at the output of free which will show you
how much of the memory is used by buffers & caches.

If that number is also low you should look to see how much memory your
applications are using.

Also, what are your shared_buffer and sort_mem settings set to in
postgresql.conf ?
Remember in Linux top will include how much shared memory an app has
touched in its SIZE. (But you can also look at the shared column to see
how much of hte size is shared)
.
--
Jeff Trout <je**@jefftrout .com>
http://www.jefftrout.com/
http://www.stuarthamm.net/
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 23 '05 #3

On Sep 16, 2004, at 11:26 AM, ruben wrote:
Thanks Jeff:

This is the output of free:

total used free shared buffers cached
Mem: 1031012 1018608 12404 0 64984 848160
-/+ buffers/cache: 105464 925548
Swap: 2040244 0 2040244
a vast majority of your ram is all in cache.
thats is good. It means the memory isn't being wasted.
shared_buffers and sort_mem are both commented in postgresql.conf :

-bash-2.05b$ grep shared_buf data/postgresql.conf
#shared_buffers = 64 # 2*max_connectio ns, min 16
-bash-2.05b$ grep sort_m data/postgresql.conf
#sort_mem = 512 # min 32

that is an extremely small value of shared buffers.
you should set it to at least 1000, maybe even 10000.
You'll likely get a nice performance boost by increasing it.
I have verified that postgres is not the responsible for the low
performance of the system, but I just wanted to be sure that memory
usage is reasonable in a postgres installation.

Yes. It is fine, except I'd increase shared_buffers

--
Jeff Trout <je**@jefftrout .com>
http://www.jefftrout.com/
http://www.stuarthamm.net/
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4207
by: N.K. | last post by:
Hi, I've just installed postgres on the Linux server. It is supposed to start automatically which I think it does since I can run an sql stmt right away. When I'm trying to connect from a remote machine I get a message that the remote machine IP address is not specified in pg_hba.conf, that there is no record of that machine there. ph_hba.conf is set up correctly, because when I run the following: postmaster -i -D /var/lib/pgsql/data...
4
2851
by: Gellert, Andre | last post by:
Hello, we installed a new Postgres 7.4.0 on a Suse 9 system. This is used as a part of an extranet , based on Apache+PHP and has besides a ldap server no services running. The system has dual xeon 2ghz and 2GB RAM. When migrating all applications from 2 other postgres7.2 servers to the new one, we had heavy load problems. At the beginning there where problems with to much allocated shared memory, as the system was swapping 5-10 mb / sec...
3
8705
by: warwick.poole | last post by:
I am interested in finding out about Enterprise scale Postgres installations and clustering, especially on Linux. Essentially I would like to know the possibility that Postgres can store the database data in a central location (ex: on a SAN fiber array) and have a cluster of machines sharing processor/RAM/IO bandwidth to do the application processing. Or perhaps there is another solution similar to what www.emicnetworks.com have...
6
2050
by: Anony Mous | last post by:
Hi, We've got some clients that are concerned about running Postgresql 7.3.4 on a Win2k Server box, alongside MS SQL Server. I've been running pg on my XP machines for a long time now (with cygwin) and never had any sort of problem. The db is fast and stable. Does anyone have any experience that would give some weight to our client's concerns? Would there be any potential conflict between the postmaster and MS SQL Server? Your...
6
2955
by: Prabu Subroto | last post by:
Dear my friends... Usually I use MySQL. Now I have to migrate my database from MySQL to Postgres. I have created a database successfully with "creatdb" and a user account successfully. But I can not access the postgres with pgaccess.
18
5155
by: Joe Lester | last post by:
This thread was renamed. It used to be: "shared_buffers Question". The old thread kind of died out. I'm hoping to get some more direction by rephrasing the problem, along with some extra observations I've recently made. The core of the problem is that Postgres is filling up my hard drive with swap files at the rate of around 3 to 7 GB per week (that's Gigabytes not Megabytes) . At this rate it takes roughly two months to fill up my 40...
17
4130
by: Josh Close | last post by:
I know this is kinda a debate, but how much ram do I give postgres? I've seen many places say around 10-15% or some say 25%....... If all this server is doing is running postgres, why can't I give it 75%+? Should the limit be as much as possible as long as the server doesn't use any swap? Any thoughts would be great, but I'd like to know why. Thanks.
1
4383
by: micofarmer | last post by:
We are running a PHP web-based frontend with a Postgres 7.2 backend on a Windows 2000 Server box with automated backups of the server being handled by Legato. We are experiencing several problems that point in the general direction of the backup process but we have nothing concrete. The Legato system runs incremental backups Monday through Saturday with a full server backup on Sunday. The problems we are seeing are mainly database...
1
2042
by: Jean-Paul Calderone | last post by:
On Tue, 22 Apr 2008 14:54:37 -0700 (PDT), yzghan@gmail.com wrote: The test doesn't demonstrate any leaks. It does demonstrate that memory usage can remain at or near peak memory usage even after the objects for which that memory was allocated are no longer live in the process. This is only a leak if peak memory goes up again each time you create any new objects. Try repeated allocations of a large dictionary and observe how memory...
0
9531
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7332
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.