473,788 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CREATE DATABASE on the heap with PostgreSQL?

DBMS like MySQL and hsqldb (the only two I know that can keep and
process tables on the heap) have a CREATE DATABASE case in which the
'database' is specified to reside in memory, that is RAM. For some
data handling cases for which persistence is not important, this is
all you need.

These types of DBs are very fast and convenient for temporary and
transient 'tables' you don't really need or care to persist, like
session tables for web based applications and temporary tables usually
built in subqueries that might be OK for the next request.

Some hacks I could think about is running "SELECT * " on the needed
table at the start of the DB engine and periodically and -hope- the
operative system keeps it in the cache, but I have the gut feeling,
having such a feature in the DBMS itslef should be faster.

After RTFM and googling for this piece of info, I think PostgreSQL
has no such a feature.

Why not?

. Isn't RAM cheap enough nowadays? RAM is indeed so cheap that you
could design diskless combinations of OS + firewall + web servers
entirely running off RAM. Anything needing persistence you will send
to the backend DB then

. Granted, coding a small Data Structure with the exact functionality
you need will do exactly this "keeping the table's data on the heap".
But why doing this if this is what DBMS have been designed for in the
first place? And also, each custom coded DB functionality will have to
be maintaned.

Is there any way or at least elegant hack to do this?

I don't see a technically convincing explanation to what could be a
design decision, could you explain to me the rationale behind it, if
any?
Nov 23 '05 #1
7 1915
Albretch wrote:
After RTFM and googling for this piece of info, I think PostgreSQL
has no such a feature.

Why not?

. Isn't RAM cheap enough nowadays? RAM is indeed so cheap that you
could design diskless combinations of OS + firewall + web servers
entirely running off RAM. Anything needing persistence you will send
to the backend DB then
. Granted, coding a small Data Structure with the exact functionality
you need will do exactly this "keeping the table's data on the heap".
But why doing this if this is what DBMS have been designed for in the
first place? And also, each custom coded DB functionality will have to
be maintaned.

Is there any way or at least elegant hack to do this?

I don't see a technically convincing explanation to what could be a
design decision, could you explain to me the rationale behind it, if
any?

If you access a table more frequently then other and you have enough
RAM your OS will mantain that table on RAM, don't you think ?
BTW if you trust on your UPS I'm sure you are able to create a RAM
disk and place that table in RAM.
Regards
Gaetano Mendola


Nov 23 '05 #2
Gaetano Mendola <me*****@bigfoo t.com> wrote in message news:<40******* *******@bigfoot .com>...
If you access a table more frequently then other and you have enough
RAM your OS will mantain that table on RAM, don't you think ?
BTW if you trust on your UPS I'm sure you are able to create a RAM
disk and place that table in RAM.
Regards
Gaetano Mendola


RAMdisks still need a hard disk drive to operate. I am talking here
about entirely diskless configurations.

Well, maybe as I suspected there is no technical explanation why this
design decision has been made.

When I have more time I will run a bechmark to check to which extent
it does make a difference. I mean running the application from RAM and
letting the DBMS know about it instead of letting the OS figure it
out.
Nov 23 '05 #3
Gaetano Mendola <me*****@bigfoo t.com> wrote in message news:<40******* *******@bigfoot .com>...
If you access a table more frequently then other and you have enough
RAM your OS will mantain that table on RAM, don't you think ?
BTW if you trust on your UPS I'm sure you are able to create a RAM
disk and place that table in RAM.
Regards
Gaetano Mendola


RAMdisks still need a hard disk drive to operate. I am talking here
about entirely diskless configurations.

Well, maybe as I suspected there is no technical explanation why this
design decision has been made.

When I have more time I will run a bechmark to check to which extent
it does make a difference. I mean running the application from RAM and
letting the DBMS know about it instead of letting the OS figure it
out.
Nov 23 '05 #4
Hi,

The original poster seemed not to care too much about whether the data
in this database is persistent. Under that assumption, I wonder if it's
possible to do the following:

1- start postmaster
2 - create database on RAM disk (will be easy once tablespaces are there)
3 - work with this database
4 - postmaster shuts down / reboot server
5 - start postmaster
6 - create database ...

The question is whether 5/6 will work, as the database will have entries
in the system catalogs, and since the data of the database has
disappeared. I.e. postmaster will probably complain mightly on startup.

Perhaps it's possible to first start postmaster in single user mode to
clean up the system catalogs?

Maarten

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #5
Hi,

The original poster seemed not to care too much about whether the data
in this database is persistent. Under that assumption, I wonder if it's
possible to do the following:

1- start postmaster
2 - create database on RAM disk (will be easy once tablespaces are there)
3 - work with this database
4 - postmaster shuts down / reboot server
5 - start postmaster
6 - create database ...

The question is whether 5/6 will work, as the database will have entries
in the system catalogs, and since the data of the database has
disappeared. I.e. postmaster will probably complain mightly on startup.

Perhaps it's possible to first start postmaster in single user mode to
clean up the system catalogs?

Maarten

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #6
Maarten Boekhold <bo******@emira tes.net.ae> writes:
The original poster seemed not to care too much about whether the data
in this database is persistent. Under that assumption, I wonder if it's
possible to do the following: 1- start postmaster
2 - create database on RAM disk (will be easy once tablespaces are there)
3 - work with this database
4 - postmaster shuts down / reboot server
5 - start postmaster
6 - create database ... The question is whether 5/6 will work, as the database will have entries
in the system catalogs, and since the data of the database has
disappeared. I.e. postmaster will probably complain mightly on startup.


You'd probably have to do a manual "DELETE FROM pg_database" to get rid
of the row, but as of right now I don't think there'd be any other
cleanup needed. The tablespace patch might complicate the picture though.

regards, tom lane

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

Nov 23 '05 #7
Maarten Boekhold <bo******@emira tes.net.ae> writes:
The original poster seemed not to care too much about whether the data
in this database is persistent. Under that assumption, I wonder if it's
possible to do the following: 1- start postmaster
2 - create database on RAM disk (will be easy once tablespaces are there)
3 - work with this database
4 - postmaster shuts down / reboot server
5 - start postmaster
6 - create database ... The question is whether 5/6 will work, as the database will have entries
in the system catalogs, and since the data of the database has
disappeared. I.e. postmaster will probably complain mightly on startup.


You'd probably have to do a manual "DELETE FROM pg_database" to get rid
of the row, but as of right now I don't think there'd be any other
cleanup needed. The tablespace patch might complicate the picture though.

regards, tom lane

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

Nov 23 '05 #8

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

Similar topics

3
2637
by: Domagoj Cajic | last post by:
First i want to say that i just subscribed to this mailing list and this is my first post. :) im new to postgresql and i installed it recently on linux redhat 9 system following the instructions from administrators tutorial. then i attempted to create "my first database" following the instructions from tutorial, but i get this message: # createdb mydb
5
33605
by: Thomas LeBlanc | last post by:
I copied an example from the help: CREATE FUNCTION somefunc() RETURNS integer AS ' DECLARE quantity integer := 30; BEGIN RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 30 quantity := 50; -- -- Create a subblock
5
3276
by: Frank van Vugt | last post by:
Hi, I noticed that when using the single commandline: drop database <name>; create database <name>; this sometimes fails due to a pg_autovacuum process running on the background. When this happens, the error returned is:
17
8506
by: Jeffrey W. Baker | last post by:
Greetings, I have a 23GB data table upon which I am building a primary key of three columns. The data is mounted in a 137GB device and pg_xlog is mounted on a separate 3.5GB device. I have configured 24 checkpoint segments, which I expect gives me a worst-case usage in pg_xlog of 384MB. Unfortunately, during the CREATE INDEX, pg_xlog becomes full!
1
389
by: Albretch | last post by:
DBMS like MySQL and hsqldb (the only two I know that can keep and process tables on the heap) have a CREATE DATABASE case in which the 'database' is specified to reside in memory, that is RAM. For some data handling cases for which persistence is not important, this is all you need. These types of DBs are very fast and convenient for temporary and transient 'tables' you don't really need or care to persist, like session tables for web...
19
2758
by: Andy B | last post by:
Hello, Sorry for this newbish question. Briefly, my problem: ------------------ I expect the database I'm working on to reach something in the order of 12-16 Gigabytes, and I am interested in understanding as much as I can about how I can make this go as fast as possible on a linux system. I haven't run such a large database before. The nature of the database is such that
3
3629
by: Ulrich Wisser | last post by:
Hi, last night I tried to reindex my database with some really ugly results. I can no longer use the database. backend> REINDEX DATABASE "CLIX1" NOTICE: relation 16416 was reindexed NOTICE: relation 1255 was reindexed NOTICE: relation 16410 was reindexed NOTICE: relation 1247 was reindexed
4
4426
by: Ying Lu | last post by:
Hello, I have a table named "USER" under MySQL database. When I am trying to move tables from MySQL to PostgreSQL, I found that I could not create a table namely "USER". I guess "USER" is a key string used by PostgreSQL system so that we could not create a table named "USER". Is that true? Thanks a lot, Emi Lu
30
3424
by: Wes | last post by:
On a nightly basis, we shut the database down and do a file system backup. A short chronology of our database problem: 8/21 - count(*) of user tables succeeded (done once a week to get statistics) 8/23 - A specific search on a specific value (one out of over 2 million) caused postmaster to SEGV. I dropped the index in question and rebuilt it. All appeared ok.
6
2992
by: Michelle Konzack | last post by:
Hello all, I have accidently :-) found 'initlocation' and now I like to know, how many secondary database i can create. I like to do that, because I have a Virtual Webserver and for each VirtualHost I have a local $USER. Now I like to create seperatly secondary databases for each $USER/VHost. Thanks
0
9656
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
9498
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
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8993
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
7517
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
6750
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
5398
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
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.