Re: [SQL] olympics ranking query

2007-03-29 Thread Kyle Bateman
Several years ago someone posted a question about how to achieve a running total of columns in sql. I have been trying to find a solution to a similar problem for some time and just came up with something that works great for me so I thought I'd post it for the benefit of the list. The proble

Re: [SQL] Foreign Unique Constraint

2007-03-29 Thread Jon Horsman
use a pre-insert triggers - one for each table. include something like I ended up going this route and it seems to work. Thanks for the help from all. I figured i'd post the solution to the list so it shows up when googled. Also, if my solution can be simplfied i'd appreciate knowing how. Th

Re: [SQL] Track query status

2007-03-29 Thread Rajesh Kumar Mallah
more methods: 1. select * from pg_stat_activity; see what all running and pid of your current query also. 2. SELECT h.pid AS blocker, w.pid AS blockee FROM ONLY pg_locks h, ONLY pg_locks w WHERE h."granted" AND NOT w."granted" AND (h.relation = w.relation AND h."database" = w."database" OR h.

Re: [SQL] Empty Table

2007-03-29 Thread Rajesh Kumar Mallah
>I dont think i clearly understand your requirement. > >Are you wanting to restore the "PLAIN" backup of a database >with a different database name ? > Yes Are you getting any particular error? what platform are you in ? >what do you mean "deleting information of current database ..." > Clear

Re: [SQL] Empty Table

2007-03-29 Thread Rajesh Kumar Mallah
I dont think i clearly understand your requirement. Are you wanting to restore the "PLAIN" backup of a database with a different database name ? what do you mean "deleting information of current database ..." I have not used pgAdmin as i prefer cmd line mostly. eager to help, (expect my next

Re: [SQL] Empty Table

2007-03-29 Thread ezequias
Thank you all for a so fast reply. I did a backup PLAIN with pgAdmin and I had to delete the information of the current database (the database I used to make the backup). I think that's why pgAdmin does not work with plain backups on Restore. What does occurs with the information schema when

Re: [SQL] Empty Table

2007-03-29 Thread Rajesh Kumar Mallah
psql> TRUNCATE TABLE ; if you have too many tables , generate the above commands by using a query on tables information schema table. hope it helps. On 3/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi list, I have many tables with many constraints and I would like to empty all my table

[SQL] Empty Table

2007-03-29 Thread ezequias
Hi list, I have many tables with many constraints and I would like to empty all my tables. There is any simple way to do it ? I have pgAdmin here but not psql. Any help would be glad. Regards Ezequias -- Ezequias Rodrigues da Rocha ---(end of broadcast)---

Re: [SQL] Temp tbl Vs. View

2007-03-29 Thread Rodrigo De León
On 3/29/07, Radhika Sambamurti <[EMAIL PROTECTED]> wrote: Hello, I have an interesing problem relating to sql and performance issues and am looking at ways I can increase the performace from postgres. Currently I have a view created from two tables. All the selects are being done on the view -

Re: [SQL] Temp tbl Vs. View

2007-03-29 Thread Richard Broersma Jr
> select from the view is taking a lot of time (7000 ms) as per explain > analyze. Both the primary and secondary tables have about 400,000 rows. > > My question is how can I fix this? > Would it be better to create a temporary table for just daily data and > have the view for more extended queri

[SQL] Temp tbl Vs. View

2007-03-29 Thread Radhika Sambamurti
Hello, I have an interesing problem relating to sql and performance issues and am looking at ways I can increase the performace from postgres. Currently I have a view created from two tables. All the selects are being done on the view - which normally does not take a lot of time, but because my w