[GENERAL] Query not using index

2008-09-22 Thread Troy Rasiah
hello all, I'm having troubles getting the following statement to use the index on 'gazette'. If i remove the order by condition it then uses the index. Below is the explain analyse. The first explain analyse is the one i'm having problems with. The second explain analyse is from a different

Re: [GENERAL] PL/Python - Execute return results

2008-09-22 Thread Tino Wildenhain
Hi, Dean Grubb wrote: Hi, plan = plpy.prepare(SELECT last_name FROM my_users WHERE first_name = $1, [ text ]) rv = plpy.execute(plan, [ name ], 5) return rv[last_name] If the SELECT command does not return any results, how do I catch/check for this? I'm surprised to find you directly

Re: [GENERAL] [HACKERS] macport for libpqxx

2008-09-22 Thread Dave Page
On Sat, Sep 20, 2008 at 5:25 PM, Darren Weber [EMAIL PROTECTED] wrote: Hi Dave, Thanks for getting back to me. Please find attached a draft Portfile for libpqxx-2.6.9 (the stable version). It's easy to read the Portfile to see what is going on. I think it should work fine, but I would

[GENERAL] Getting cozy with weekly PITR

2008-09-22 Thread Joey K.
Hello, Thanks for advice/suggestions on PITR so far. We have finally decided to do weekly PITR base backups. Just have one nagging question. == week 1==- * pg_start_backup() * tar -cvzf basebackup_week1.tar.gz pgdata/ * pg_stop_backup() cp WAL1 week1/wal/ .. cp WAL2 week1/wal/ ==*== Week 1,

Re: [GENERAL] Synchronize two similar tables: recursive triggers

2008-09-22 Thread Michael Toews
If anyone is interested, here is my solution to my problem, which I hope will be obsolete when the issues with the FDO PostGIS provider are fixed. I have also successfully tested this setup out with foreign key constraints in the primary table only --- the secondary tables just use primary key

Re: [GENERAL] Largest PostgreSQL 8.x DB someone is running?

2008-09-22 Thread Asko Oja
On Mon, Sep 22, 2008 at 7:14 AM, Keaton Adams [EMAIL PROTECTED] wrote: What is the the largest PostgreSQL 8.x database that is running in a production environment that you are aware of? We top out at roughly 400 GB but have a need for a new project to go much, much larger (in the several TB

Re: [GENERAL] R-tree, order by, limit

2008-09-22 Thread Mark Cave-Ayland
Anton Belyaev wrote: I am implementing a map application. There are towns with altitude, longitude and population. One of the tasks is to be able to query N biggest (by population) towns within a rectangle. Hi Anton, Have you considered using PostGIS? (http://postgis.refractions.net). It

Re: [GENERAL] Getting cozy with weekly PITR

2008-09-22 Thread Bohdan Linda
pg_start_backup will flush old transactions, thus you have full DB backup. Unless you want them archived, no need to keep them Regards, Bohdan On Mon, Sep 22, 2008 at 09:41:47AM +0200, Joey K. wrote: During week 2, after the base backup, can we remove week 1's base and WAL files? -- Sent

Re: [GENERAL] R-tree, order by, limit

2008-09-22 Thread Anton Belyaev
2008/9/21 Martijn van Oosterhout [EMAIL PROTECTED]: On Sun, Sep 21, 2008 at 06:17:39PM +0400, Anton Belyaev wrote: Geometry types and functions use R-tree indexes anyways. I can rephrase the query using geometry language of Postgres: SELECT * FROM towns WHERE towns.coordinates @ box(alt1,

Re: [GENERAL] R-tree, order by, limit

2008-09-22 Thread Anton Belyaev
2008/9/22 Mark Cave-Ayland [EMAIL PROTECTED]: I am implementing a map application. There are towns with altitude, longitude and population. One of the tasks is to be able to query N biggest (by population) towns within a rectangle. Have you considered using PostGIS?

Re: [GENERAL] R-tree, order by, limit

2008-09-22 Thread Volkan YAZICI
On Sun, 21 Sep 2008, Anton Belyaev [EMAIL PROTECTED] writes: And the questions about population remain the same: How to avoid examination of all the towns in the rectangle knowing that we need only 10 biggest? Does population worth including into a (3D) point (In order to create a 3D R-tree)?

Re: [GENERAL] PDF Documentation for 8.3?

2008-09-22 Thread Sam Mason
On Fri, Sep 19, 2008 at 08:56:50PM +0200, Michelle Konzack wrote: Note: The american Letter format sucks, because I am printing two A4 pages on ONE A4 side and with the Letter format I get very huge borders... I find the psnup command (part of psutils) useful here, I tend to

Re: [GENERAL] R-tree, order by, limit

2008-09-22 Thread Mark Cave-Ayland
Anton Belyaev wrote: Mark, thanks for the suggestion. I examined PostGIS some time ago. It is too complex for my simple task and it gives no advantages for me: Well okay but bear in mind the PostGIS is the de-facto standard for most open source GIS tools. Programs like QGIS et al can

Re: [GENERAL] Triggers not working

2008-09-22 Thread Tom Lane
Dale Harris [EMAIL PROTECTED] writes: I'm running PostgreSQL 8.3.3 and I'm having trouble with triggers not always working. I have the following tables and functions as documented below. My problem is that if I perform an update on the Entity table and modify the Code field, why doesn't the

[GENERAL] Thesis resource help

2008-09-22 Thread Jiri Ogurek
Hello, i'm starting to write my thesis for the Degree of Master of Science in Information Systems, it's topic Principals and methods of hashing in relational database technology with practical verification of collisions occurrence, i would like to focus on PgSQL. I would like to ask someone

[GENERAL] How to remove duplicate subqueries

2008-09-22 Thread Andrus
I have query SELECT ... ( SELECT ... FROM (q1) p1 WHERE ... UNION ALL SELECT ... FROM (q1) p2 WHERE ... ) p3 GROUP BY f1,f2,f3 This query contains q1 query twice. q1 takes long time to execute. PostgreSQL probably will execute it two times. How to force PostgreSQL 8.1 to execute q1 only once

[GENERAL] Help with query to return indexes (including functional ones!) on a given table

2008-09-22 Thread Philip Hallstrom
Hi all - I'm trying to add functional index support to Rails' Active Record and am getting stuck when it comes to a method Rails has to print out the indexes associated with a given table. The SQL being run is below: SELECT distinct i.relname, d.indisunique, a.attname FROM pg_class t, pg_class

[GENERAL] match an IP address

2008-09-22 Thread Joao Ferreira gmail
hello all, I'm unable to build a LIKE or SIMILAR TO expression for matching and ip address 192.168.90.3 10.3.2.1 any help please... thanks joao -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] match an IP address

2008-09-22 Thread hubert depesz lubaczewski
On Mon, Sep 22, 2008 at 05:59:25PM +0100, Joao Ferreira gmail wrote: I'm unable to build a LIKE or SIMILAR TO expression for matching and ip address 192.168.90.3 10.3.2.1 any help please... any reason not to use standard inet datatype? which does the validation. Best regards, depesz --

Re: [GENERAL] match an IP address

2008-09-22 Thread Raymond O'Donnell
On 22/09/2008 17:59, Joao Ferreira gmail wrote: I'm unable to build a LIKE or SIMILAR TO expression for matching and ip address There are built-in types in PG for handling IP addresses - are they any use to you? If not, there's a useful site here which may get you started:

Re: [GENERAL] match an IP address

2008-09-22 Thread Scott Marlowe
On Mon, Sep 22, 2008 at 10:59 AM, Joao Ferreira gmail [EMAIL PROTECTED] wrote: hello all, I'm unable to build a LIKE or SIMILAR TO expression for matching and ip address 192.168.90.3 10.3.2.1 As already mentioned inet / cidr types should work. Example: postgres=# create table inettest (a

Re: [GENERAL] match an IP address

2008-09-22 Thread Joao Ferreira gmail
well... my IP addresses are stored in a TEXT type field. that field can actually contain usernames like 'joao' or 'scott' and it can contain IP addresses :( joao On Mon, 2008-09-22 at 11:13 -0600, Scott Marlowe wrote: On Mon, Sep 22, 2008 at 10:59 AM, Joao Ferreira gmail [EMAIL

Re: [GENERAL] match an IP address

2008-09-22 Thread Scott Marlowe
On Mon, Sep 22, 2008 at 11:16 AM, Joao Ferreira gmail [EMAIL PROTECTED] wrote: well... my IP addresses are stored in a TEXT type field. that field can actually contain usernames like 'joao' or 'scott' and it can contain IP addresses Then cast them to inet and use the method I showed

Re: [GENERAL] match an IP address

2008-09-22 Thread Tino Wildenhain
Hi, Joao Ferreira gmail wrote: well... my IP addresses are stored in a TEXT type field. that field can actually contain usernames like 'joao' or 'scott' and it can contain IP addresses Any reason not to change this in the first place? For a quick fix you could use regex to find the

Re: [GENERAL] match an IP address

2008-09-22 Thread Phoenix Kiula
my IP addresses are stored in a TEXT type field. that field can actually contain usernames like 'joao' or 'scott' and it can contain IP addresses I think this is common DB design on many websites that have registered user IDs. My humble suggestion would be to make another column in

Re: [GENERAL] match an IP address

2008-09-22 Thread Tino Wildenhain
Phoenix Kiula wrote: my IP addresses are stored in a TEXT type field. that field can actually contain usernames like 'joao' or 'scott' and it can contain IP addresses I think this is common DB design on many websites that have registered user IDs. Is it? Name one! Sounds like crappy

Re: [GENERAL] match an IP address

2008-09-22 Thread Phoenix Kiula
I think this is common DB design on many websites that have registered user IDs. Is it? Name one! Sounds like crappy design to me. It might sound crappy design to you, but for websites that allow users to do something while they are registered OR unregistered, will choose to

Re: [GENERAL] Triggers not working

2008-09-22 Thread Dale Harris
Hi Tom, The trigger trAccountUpdate got called, but why didn't the trigger trEntityUpdate get called? Regards, Dale Harris. -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Monday, 22 September 2008 22:22 To: Dale Harris Cc: pgsql-general@postgresql.org Subject: Re:

Re: [GENERAL] how to return the first record from the sorted records which may have duplicated value.

2008-09-22 Thread Yi Zhao
yes,  select distinct max(pop),query from test group by query test=# select distinct max(pop),query from bar group by query; max | query -+--- 8 | bar 16 | def 20 | foo 30 | abc but, I want to get the records contains more than two columns(max, query, dfk), so, if I use

Re: [GENERAL] pg_start_backup() takes too long

2008-09-22 Thread Bruce Momjian
Ivan Zolotukhin wrote: Hello, What is the reason for select pg_start_backup('label'); taking 10 minutes on not so loaded system even right after manual checkpoint? No idea; something is seriously wrong if that is happening. Do the database server logs or kernel logs show anything

Re: [GENERAL] how to return the first record from the sorted records which may have duplicated value.

2008-09-22 Thread Yi Zhao
yes, thanks u very much, it's work:) regards, Yi On Fri, 2008-09-19 at 11:06 +0200, Andreas Kretschmer wrote: Yi Zhao [EMAIL PROTECTED] schrieb: hi all: I have a table with columns(2) named query, pop, dfk. what I want is: when I do some select, if the column query in result records

Re: [GENERAL] Help with query to return indexes (including functional ones!) on a given table

2008-09-22 Thread Tom Lane
Philip Hallstrom [EMAIL PROTECTED] writes: I'm trying to add functional index support to Rails' Active Record and am getting stuck when it comes to a method Rails has to print out the indexes associated with a given table. The SQL being run is below: SELECT distinct i.relname,

Re: [GENERAL] Triggers not working

2008-09-22 Thread Tom Lane
Dale Harris [EMAIL PROTECTED] writes: The trigger trAccountUpdate got called, but why didn't the trigger trEntityUpdate get called? Triggers only apply to the exact table they're declared on, not to child tables. It does seem like there might be some use-case for applying a trigger to child

Re: [GENERAL] Triggers not working

2008-09-22 Thread Dale Harris
I would have called the Entity table the parent table and not the child table as the Account table inherits from Entity. Therefore it appears that the trigger only works on the table where the actual row was added/belongs to. It would be great if triggers on the parent table would work for any

Re: [GENERAL] match an IP address

2008-09-22 Thread Craig Ringer
Tino Wildenhain wrote: Phoenix Kiula wrote: my IP addresses are stored in a TEXT type field. that field can actually contain usernames like 'joao' or 'scott' and it can contain IP addresses I think this is common DB design on many websites that have registered user IDs. Is it? Name