Re: [GENERAL] How to reduce WAL file Size

2009-10-08 Thread Mitesh51
I am dealing with backup of databases. Now eventhough there are not many changes in the DB, it creates WAL file of 16 mb. Now because I am working on a application which takes full & inc backup of db after specific intervals..if for small changes it creates 16 mb files then storing them will eat u

Re: [GENERAL] Tips/Hacks to create minial DB from the execution of several (simple) SQL requests.

2009-10-08 Thread Scott Bailey
Daniel Shane wrote: Hi Scott! The problem is that my test database has several tables with many links between them, so I have no idea which 1000 rows to get from which table. The only thing I can do is run the program that connects to that database and tell it to run on a sample of the databa

Re: [GENERAL] Best data type to use for sales tax percent

2009-10-08 Thread Lew
Rich Shepard wrote: On Thu, 8 Oct 2009, Mike Christensen wrote: I'll probably just use 3,3 and store this value between 0 and 1, since all I'll be doing with this number is using it to multiply against a subtotal. 3,3 gives me 0.000 through 0.999, correct? Mike, No. The two digits represe

Re: [GENERAL] interface for "non-SQL people"

2009-10-08 Thread Scott Marlowe
On Thu, Oct 8, 2009 at 2:22 PM, Merlin Moncure wrote: > > The #1 tool you have at your disposal is the human brain.  I > personally think GUI database tools are counter productive and huge > time wasters.  SQL requires lateral thinking but once you have your > head around how joins work and the ge

Re: [GENERAL] Best data type to use for sales tax percent

2009-10-08 Thread Rich Shepard
On Thu, 8 Oct 2009, Mike Christensen wrote: I'll probably just use 3,3 and store this value between 0 and 1, since all I'll be doing with this number is using it to multiply against a subtotal. 3,3 gives me 0.000 through 0.999, correct? Mike, No. The two digits represent the width of the c

Re: [GENERAL] How to reduce WAL file Size

2009-10-08 Thread Alban Hertroys
On 8 Oct 2009, at 9:35, Mitesh51 wrote: By setting postgres.conf params...log files are generated of 16 MB each. How can I reduce the size of this files? & can I force the log files to switch with any command as we do in mysql like flush log? where we force the new log creation ? Why do

Re: [GENERAL] Best data type to use for sales tax percent

2009-10-08 Thread Mike Christensen
Oops sorry I was thinking 2,3 meant 2 significant digits to the left of the decimal point and 3 to the right. I just re-read the docs and now see what you mean. 6,3 would work fine though is maybe a bit overkill since a 100% sales tax rate would cause a violent revolution and lead to beheadings,

Re: [GENERAL] Best data type to use for sales tax percent

2009-10-08 Thread Merlin Moncure
On Thu, Oct 8, 2009 at 6:04 PM, Mike Christensen wrote: > (Sorry for the super-easy question) > > I want to store sales tax (as a percent) in the DB, such as 9.5%. > What's the best data type for this?  I'm guessing numeric(2,3) should > be fine, yes?  I'm not too familiar with the numeric type (I

Re: [GENERAL] Best data type to use for sales tax percent

2009-10-08 Thread Christophe Pettus
On Oct 8, 2009, at 3:04 PM, Mike Christensen wrote: I'm guessing numeric(2,3) should be fine, yes? Numeric is definitely what you want. You probably want at least four fractional digits, since sales tax (at least in California) is routinely set to a quarter of a point. For example, the b

Re: [GENERAL] Best data type to use for sales tax percent

2009-10-08 Thread Steve Crawford
Mike Christensen wrote: (Sorry for the super-easy question) I want to store sales tax (as a percent) in the DB, such as 9.5%. What's the best data type for this? I'm guessing numeric(2,3) should be fine, yes? I'm not too familiar with the numeric type (I was using "real" before), but as I unde

[GENERAL] Best data type to use for sales tax percent

2009-10-08 Thread Mike Christensen
(Sorry for the super-easy question) I want to store sales tax (as a percent) in the DB, such as 9.5%. What's the best data type for this? I'm guessing numeric(2,3) should be fine, yes? I'm not too familiar with the numeric type (I was using "real" before), but as I understand the data will be st

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Alvaro Herrera
Leonardo M. Ramé escribió: > select > idturno, > infres::text > from turno > where > infres::text ~~ $$%diagn'f3stico%$$; Just make sure you don't have $$ in the search pattern ... -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Leonardo M.
On jue, 2009-10-08 at 17:51 -0300, Emanuel Calvo Franco wrote: > part=# select * from p where i::text ~~ $$%''f3%$$; > i > -- > ''f3 > (1 row) > > I don't have any problem, wich enconding you are using? > (select getdatabaseencoding(); ) > Thanks, now this works: set stan

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Emanuel Calvo Franco
2009/10/8 Leonardo M. : > On jue, 2009-10-08 at 17:01 -0300, Emanuel Calvo Franco wrote: >> > select >> >  * >> > from my_table >> > where >> >  cast(rtf_field as varchar) like '%condition%' >> > >> > This works ok when the condition doesn't include accented chars. RTF >> > escapes accented charact

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Leonardo M.
On jue, 2009-10-08 at 17:01 -0300, Emanuel Calvo Franco wrote: > > select > > * > > from my_table > > where > > cast(rtf_field as varchar) like '%condition%' > > > > This works ok when the condition doesn't include accented chars. RTF > > escapes accented characters as "\'f1" for í, "\'f3" for ó,

[GENERAL] Using pg_catalog to define things across schemas

2009-10-08 Thread Andreas Kalsch
I am currently trying to solve the problem by using different schemas, but then I have to consider all the GIS stuff. Putting the same things in different schemas is no problem, but comparing the same type defined in different schemas will lead to confusion, because Postgres treats them as diff

Re: [GENERAL] interface for "non-SQL people"

2009-10-08 Thread Merlin Moncure
On Tue, Oct 6, 2009 at 3:47 PM, pere roca wrote: > > >  hi, >  some nice tool over there to let non-SQL knowing people to construct their > queries? I'm using pgAdmin III but I know some SQL. >  there is no other option than constructing an HTML with forms, drop-down > menus...? Cant help it :-)

Re: [GENERAL] Renaming constraints

2009-10-08 Thread Thom Brown
2009/10/8 Tom Lane > You'd probably better rename the constraint too to avoid confusion. > Failing anything else, there's always direct UPDATE of the pg_constraint > catalog. > > If it's only a matter of the entry in the pg_constraint catalog being changed, couldn't a more intuitive SQL-style ins

Re: [GENERAL] Renaming constraints

2009-10-08 Thread Tom Lane
Andreas Kalsch writes: > But with this operation you will recreate the whole index. - I have > found out, that the name of the constraint's index is the same as the > constraint, so that I can simply rename the index. You'd probably better rename the constraint too to avoid confusion. Failing a

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Emanuel Calvo Franco
> select >  * > from my_table > where >  cast(rtf_field as varchar) like '%condition%' > > This works ok when the condition doesn't include accented chars. RTF > escapes accented characters as "\'f1" for í, "\'f3" for ó, and so on. > > To escape \ and ', I'd read it shuld be used \\ and '', so I th

Re: [GENERAL] Renaming constraints

2009-10-08 Thread Andreas Kalsch
But with this operation you will recreate the whole index. - I have found out, that the name of the constraint's index is the same as the constraint, so that I can simply rename the index. My problem is that I want to "hook up" a new version of existing tables into my production system. 1) W

Re: [GENERAL] Remote connection timed out

2009-10-08 Thread Steve Crawford
Barbara Stephenson wrote: Hello, We have a website that connects remotely to our 8.3 postgres database. I've noticed if I connect to the database and let it sit for an hour the connection is lost. Is there a default connection timeout? How "remote"? Through firewalls/VPNs/etc.? My suspic

[GENERAL] Broken WAL recovery, resetting to base timeline

2009-10-08 Thread David Jantzen
Hi All, While recovering a database, we encountered a file permissions problem on new WAL segments that caused recovery with pg_standby to exit prematurely. Now the database is in a new timeline. What we need to do (I think) is reset the database timeline to that of the base copy and resume r

Re: [GENERAL] Renaming constraints

2009-10-08 Thread David Fetter
On Thu, Oct 08, 2009 at 08:24:06PM +0200, Andreas Kalsch wrote: > How do I rename constraints? Renaming columns will not rename constraints. BEGIN; ALTER TABLE foo DROP CONSTRAINT bar; ALTER TABLE foo ADD CONSTRAINT bluf...; COMMIT; Cheers, David. -- David Fetter http://fetter.org/ Phone: +1 41

[GENERAL] Renaming constraints

2009-10-08 Thread Andreas Kalsch
How do I rename constraints? Renaming columns will not rename constraints. Andi -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Remote connection timed out

2009-10-08 Thread Barbara Stephenson
Hello, We have a website that connects remotely to our 8.3 postgres database. I've noticed if I connect to the database and let it sit for an hour the connection is lost. Is there a default connection timeout? -- Regards, Barbara Stephenson /EDI Specialist/Programmer/ *Turbo, division of

Re: [GENERAL] Tips/Hacks to create minial DB from the execution of several (simple) SQL requests.

2009-10-08 Thread Daniel Shane
Hi Scott! The problem is that my test database has several tables with many links between them, so I have no idea which 1000 rows to get from which table. The only thing I can do is run the program that connects to that database and tell it to run on a sample of the database. I can get a log o

Re: [GENERAL] Tips/Hacks to create minial DB from the execution of several (simple) SQL requests.

2009-10-08 Thread Scott Bailey
Daniel Shane wrote: Hi all! I have an interesting problem here that I think could be of interest to everyone. I in the process of writing test cases for our applications and there is one problem I am facing. To be able to test correctly, I need to create a small database (a sample if you want) f

Re: [GENERAL] Give me a HINT or I'll got crazy ;)

2009-10-08 Thread Tom Lane
wstrzalka writes: > Prior to the playing with statistics target (it was 100 by default) I > was able to go with the time to 30ms by adding to the query such a > condition: So what sort of "playing" did you do? It looks to me like the core of the problem is the sucky join size estimate here: >

Re: [GENERAL] How to reduce WAL file Size

2009-10-08 Thread Emanuel Calvo Franco
> By setting postgres.conf params...log files are generated of 16 MB each. How > can I reduce the size of this files? & can I force the log files to switch > with any command as we do in mysql like flush log? where we force the new > log creation ? pg_switch_xlog() is the switch function. The op

[GENERAL] Tips/Hacks to create minial DB from the execution of several (simple) SQL requests.

2009-10-08 Thread Daniel Shane
Hi all! I have an interesting problem here that I think could be of interest to everyone. I in the process of writing test cases for our applications and there is one problem I am facing. To be able to test correctly, I need to create a small database (a sample if you want) from a very large on

[GENERAL] Give me a HINT or I'll got crazy ;)

2009-10-08 Thread wstrzalka
So the query is: SELECT m.messageid, mad.destination FROM messages AS m LEFT JOIN message_address_link AS mal ON (mal.message_id = m.messageid) JOIN message_address_data AS mad ON (mad.id = mal.address_id) WHERE delete_status <> 1 AND folderid=E'200702210742181172061738846603

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Sam Mason
On Thu, Oct 08, 2009 at 10:58:05AM -0300, Leonardo M. Rammm wrote: > cast(rtf_field as varchar) like '%condition%' I don't think that cast isn't doing what you expect at all. As an example, try doing something like: select cast(bytea e'hi\nbye' as varchar); encode() may be what you want ins

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Leonardo M.
On jue, 2009-10-08 at 11:28 -0400, Merlin Moncure wrote: > 2009/10/8 Leonardo M. : > > Hi, in my database I store RTF files inside a Bytea field. Now a > > customer is requesting a search inside RTF fields and I'm trying to > > implement it by issuing this query: > > > > select > > * > > from my_t

Re: [GENERAL] Query inside RTF

2009-10-08 Thread Merlin Moncure
2009/10/8 Leonardo M. : > Hi, in my database I store RTF files inside a Bytea field. Now a > customer is requesting a search inside RTF fields and I'm trying to > implement it by issuing this query: > > select >  * > from my_table > where >  cast(rtf_field as varchar) like '%condition%' > > This wo

[GENERAL] cost of query done - recorded anywhere?

2009-10-08 Thread Massa, Harald Armin
I know that is possible via EXPLAIN and EXPLAIN ANALYZE to get planned and actual time for one query - but no results. I am looking for information like: "to do this query, I had to": - read x from disk/os.cache - get n from my own buffers - do n1 comparisons of strings - do n2 comparisons of

[GENERAL] How to reduce WAL file Size

2009-10-08 Thread Mitesh51
By setting postgres.conf params...log files are generated of 16 MB each. How can I reduce the size of this files? & can I force the log files to switch with any command as we do in mysql like flush log? where we force the new log creation ? -- View this message in context: http://www.nabble.com/

[GENERAL] Need info on PQfmod()

2009-10-08 Thread shrikant hanagodimath
Hi, I need to execute the INSERT statement on the table having NUMERIC column.Also,for some reason,I need to get the precision and scale of the NUMERIC Column. Could you please let me know how can I use the PQfmod function without getting the result set. Thanks Shrikant

Re: [GENERAL] interface for "non-SQL people"

2009-10-08 Thread ssmagin
Hi, There is a http://www.activedbsoft.com/overview-querytool.html FlySpeed SQL Query tool, it's free if you don't need data export and printing. It's query builder is very good, but the author honestly says that basic knowledge of SQL concepts is required to to build a query... pere roca wro

[GENERAL] Query inside RTF

2009-10-08 Thread Leonardo M.
Hi, in my database I store RTF files inside a Bytea field. Now a customer is requesting a search inside RTF fields and I'm trying to implement it by issuing this query: select * from my_table where cast(rtf_field as varchar) like '%condition%' This works ok when the condition doesn't include

Re: [GENERAL] Using complex PRIMARY KEY

2009-10-08 Thread A. Kretschmer
In response to A. Kretschmer : > In response to Zsolt : > > > > This is our first project using PostgerSQL, where I have a problem I cant > > solve > > on a neat way (I assume PGSQL should provide a nice solution...). > > > > So we have an old xBase based program we are trying to port to Postgre

Re: [GENERAL] Using complex PRIMARY KEY

2009-10-08 Thread Gurjeet Singh
2009/10/8 Zsolt > > This is our first project using PostgerSQL, where I have a problem I cant > solve on a neat way (I assume PGSQL should provide a nice solution...). > > So we have an old xBase based program we are trying to port to PostgreSQL > while we should keep the original data structure