![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Given largely static tables (etc.), how much of ./data can I move onto R/O media? |
#3
| |||
| |||
|
|
Given largely static tables (etc.), how much of ./data can I move onto R/O media? And, which types of operations would a user then have to avoid? |
|
Loosening constraints a little, how much more could a user do if the R/O media was just "very slowly writable" media? |
|
Finally, what operations *require* the fastest media updates (i.e., "RAM")? |
#4
| |||||
| |||||
|
|
Don Y wrote: Given largely static tables (etc.), how much of ./data can I move onto R/O media? And, which types of operations would a user then have to avoid? As has been mentioned, that is not supported. |
|
For example, every checkpoint changes files in the data directory. |
|
Loosening constraints a little, how much more could a user do if the R/O media was just "very slowly writable" media? He or she could do everything, DML would be very slow. The only file that is updated frequently is $PGDATA/pg_stat_tmp/pgstat.stat, that should be the only impact on read-only queries. |
|
Finally, what operations *require* the fastest media updates (i.e., "RAM")? I am not sure if I understand you right, maybe you can clarify that question. No operation requires fast media updates. |
|
RAM disks are a bad choice for persistent data. |
#5
| ||||||
| ||||||
|
|
Given largely static tables (etc.), how much of ./data can I move onto R/O media? And, which types of operations would a user then have to avoid? As has been mentioned, that is not supported. "Supporting" R/O media and "working (properly) in its presence" are two different issues. E.g., one could argue that it is folly to have tables based in non-writable media -- but that assumes you would ALWAYS want to be able to alter those tables! |
|
For example, every checkpoint changes files in the data directory. *Every* file? I.e., the "modified" times of all files are changed AND their contents differ from what they were just prior to the event? |
|
Loosening constraints a little, how much more could a user do if the R/O media was just "very slowly writable" media? He or she could do everything, DML would be very slow. The only file that is updated frequently is $PGDATA/pg_stat_tmp/pgstat.stat, that should be the only impact on read-only queries. What about the *results* of those queries? Or, are they just pushed off to VM? |
|
Queries need to be able to store their results "somewhere". The amount and speed of that "somewhere" determines the effective rate at which queries can happen. |
|
Note that you can move individual files ("how much of ./data") to different media as their needs dictate. What I am after is some guidance as to how often/extensively particular files are updated in ./data and what operations *cause* those updates (i.e., controlling those operations means I can control those updates). |
|
To think of it in a more conventional environment, if you had limited local store, what would you chose to move off to an NAS? And, what operations would that affect? |
#6
| |||||||||
| |||||||||
|
|
Don Y wrote: Given largely static tables (etc.), how much of ./data can I move onto R/O media? And, which types of operations would a user then have to avoid? As has been mentioned, that is not supported. "Supporting" R/O media and "working (properly) in its presence" are two different issues. E.g., one could argue that it is folly to have tables based in non-writable media -- but that assumes you would ALWAYS want to be able to alter those tables! "Not supported" in that context means that if you have a problem starting a PostgreSQL server where (part of) the data directory is on a CDROM, very few people would be willing to investigate and help you solve the problem. |
|
Is that a theoretical question or do you really plan to move your database to read-only media? |
|
What is the problem behind your question? |
|
For example, every checkpoint changes files in the data directory. *Every* file? I.e., the "modified" times of all files are changed AND their contents differ from what they were just prior to the event? Of course not. I didn't say "all files". I can't give you any guarantees which files will change and which will not (I know too little). It is probably safe to assume that user tables and indexes won't ever change if you don't update (and if no VACUUM is run). |
|
Loosening constraints a little, how much more could a user do if the R/O media was just "very slowly writable" media? He or she could do everything, DML would be very slow. The only file that is updated frequently is $PGDATA/pg_stat_tmp/pgstat.stat, that should be the only impact on read-only queries. What about the *results* of those queries? Or, are they just pushed off to VM? Query results are in memory and get sent to the client. |
|
But that brings up a good point: large sorts and the like will use temporary files in the temporary tablespace if they don't fit in memory. There's another example of things that *will* be written in a read-only database. |
|
Queries need to be able to store their results "somewhere". The amount and speed of that "somewhere" determines the effective rate at which queries can happen. The effective query speed is determined by many things, |
|
depending on the kind of query. Often disk speed is the limiting factor, but with big sort and hash operations it can be RAM and CPU. Note that you can move individual files ("how much of ./data") to different media as their needs dictate. What I am after is some guidance as to how often/extensively particular files are updated in ./data and what operations *cause* those updates (i.e., controlling those operations means I can control those updates). Most files in a PostgreSQL data directory have their fixed places, they can't be moved around. |
|
To think of it in a more conventional environment, if you had limited local store, what would you chose to move off to an NAS? And, what operations would that affect? I would have the database directory on fast storage and create tablespaces in slow storage. Tables and indexes that are not used a lot (or are small and don't change much) would go there. |
#7
| |||
| |||
|
|
Is that a theoretical question or do you really plan to move your database to read-only media? The latter. Though I would qualify "database" to be "as much as practical", given the issues I put forward in the initial post. |
#8
| ||||
| ||||
|
|
I can't give you any guarantees which files will change and which will not (I know too little). It is probably safe to assume that user tables and indexes won't ever change if you don't update (and if no VACUUM is run). If you've never made any changes to the tables/indexes, why would VACUUM touch those files? (i.e., assuming the DB had been vacuumed prior to being cast in stone) |
|
Query results are in memory and get sent to the client. So, *big* query results just rely on the VM system? |
|
But that brings up a good point: large sorts and the like will use temporary files in the temporary tablespace if they don't fit in memory. There's another example of things that *will* be written in a read-only database. Yes, but temporary files can be recognized as such. I.e., it is relatively trivial to hook the creat(3c) call so that it always uses writable media. |
|
I would have the database directory on fast storage and create tablespaces in slow storage. Tables and indexes that are not used a lot (or are small and don't change much) would go there. Thanks! We'll look to see if we can identify the places where each of these actions take place and see what "rules" we can distill from them. |
#9
| |||
| |||
|
|
If you've never made any changes to the tables/indexes, why would VACUUM touch those files? (i.e., assuming the DB had been vacuumed prior to being cast in stone) I don't know the server code well enough to answer that question without some research. |
|
To really get definite answers which files in the data directory will never change, you should look for somebody who knows PostgreSQL better than I do. I suggest asking the pgsql-hackers mailing list. |
![]() |
| Thread Tools | |
| Display Modes | |
| |