Re: [GENERAL] How to write a function that manipulates a set of results

2007-03-15 Thread Ashley Moran
On 15 Mar 2007, at 00:21, Tom Lane wrote: Temp tables stay in RAM until they are bigger than temp_buffers. If you need them to be big and quick, maybe it would be appropriate to use indexes (note these count towards temp_buffers), ANALYZE, etc. You do need to realize that creation of a tem

Re: [GENERAL] How to write a function that manipulates a set of results

2007-03-14 Thread Ashley Moran
On Mar 14, 2007, at 7:25 pm, Tom Lane wrote: Sure: use a table. What was the objection to temp tables exactly? My boss is under the impression that calling the procedure twice on the same connection creates a name conflict for the temporary table. Also I'm unsure how the use of temporary

Re: [GENERAL] How to write a function that manipulates a set of results

2007-03-14 Thread Ashley Moran
On Mar 14, 2007, at 6:02 pm, Andreas Kretschmer wrote: select * from . For instance, if your SRF-function is called foo(), do: select * from foo(); Andreas, It's more complicated than that. What we need to do is something along the lines of: results = SELECT * FROM foo(); DELETE FROM

[GENERAL] How to write a function that manipulates a set of results

2007-03-14 Thread Ashley Moran
Hi I'm passing this on second hand so forgive me if I'm a bit vague... My boss is trying to write a function in PL/pgsql that manipulates a small, temporary set of data. It fetches about 20 rows from a table of approx 4 million, then it needs to do further calculations to narrow them down

Re: [GENERAL] ORDER BY

2006-11-15 Thread Ashley Moran
On Nov 14, 2006, at 10:03 pm, MicroUser wrote: Hi. I have a table: ID | Name 0 | Anna 1 | Other 2 | Link 3 | Fernando I need sorted result but the way like this: 0 | Anna 3 | Fernando 2 | Link 1 | Other Record '1 | Other' must by at the end of query result. How I can get it? Thx. I s

Re: [GENERAL] Wordpress & PostgreSQL ...

2006-10-30 Thread Ashley Moran
On 30 Oct 2006, at 06:15, Nikolay Samokhvalov wrote: Could you please give some example of such "inspired by MySQL features of PHP design"? Sorry... perhaps I should have wrapped my comment in bitterness="10"/> to make it more clear what I meant. I didn't mean that MySQL literally inspir

Re: [GENERAL] Wordpress & PostgreSQL ...

2006-10-29 Thread Ashley Moran
On Oct 29, 2006, at 10:00 pm, Dawid Kuroczko wrote: Ruby on Rails perhaps? I have not written a single line in Ruby, but I've read on the list here that it has very good PostgreSQL interface... Dawid, The Rails postgres adapter works great. In fact, by and large you don't need to care

Re: [GENERAL] Migrating PostgreSQL database to MySQL/MS Access

2006-08-13 Thread Ashley Moran
On Aug 13, 2006, at 2:16 pm, Thomas Kellerer wrote: I do agree that this might be a problem of universty education which focuses too much on theory and not on real-world problems. From what I've seen, a bigger problem is universities that focus on neither!!! Ashley -

Re: [GENERAL] Migrating PostgreSQL database to MySQL/MS Access

2006-08-13 Thread Ashley Moran
On Aug 13, 2006, at 11:34 am, Dave Page wrote: I see a similar issue in my line of work. Many of the programmers (even those working for the larger software houses in the social housing sector) have started out their careers as housing offices or maintenance surveyors or whatever and have d

Re: [GENERAL] How to use views&rules to dynamically choose which table to update

2006-03-31 Thread Ashley Moran
On Apr 01, 2006, at 12:57 am, Stephan Szabo wrote: What should it do if you try to insert something that is neither french nor english? I think an unconditional instead nothing rule might work to supplement the two conditional ones if doing nothing is okay, but I haven't tried. Wahey! The

Re: [GENERAL] How to use views&rules to dynamically choose which table to update

2006-03-31 Thread Ashley Moran
Hi David On Apr 01, 2006, at 12:13 am, David Fetter wrote: Wow. That's confusing. You're telling me! :D How about using table partitioning for this? Thanks for your suggestion. I've had a look at partitioning but the

[GENERAL] How to use views&rules to dynamically choose which table to update

2006-03-31 Thread Ashley Moran
I'm still relatively new to Postgres (at least when it comes to clever stuff - especially rules) so I hope I've missed something here. Basically I'm still trying to combine multiple databases with identical schemas into one schema, adding a column to each table to indicate which schema it c

Re: [GENERAL] What to index to speed up my UNION views?

2006-03-28 Thread Ashley Moran
On Tuesday 28 March 2006 10:05, Martijn van Oosterhout wrote: > That's because it's decribed in the SQL standard. UNION ALL just joins > the results of the two queries. UNION removes duplicates which usually > means sorting and comparing the tuples. UNION ALL is faster and usually > what you want a

Re: [GENERAL] What to index to speed up my UNION views?

2006-03-28 Thread Ashley Moran
On Monday 27 March 2006 12:13, Martijn van Oosterhout wrote: > You're using UNION rather than UNION ALL where. There's a big > difference and I imagine you actually want the latter. It also makes a > big difference in query optimisation. > > If that doesn't fix it, come back with the EXPLAIN ANALYZ

Re: [GENERAL] What to index to speed up my UNION views?

2006-03-28 Thread Ashley Moran
On Monday 27 March 2006 13:57, Jim C. Nasby wrote: > BTW, you might also find inheritance to be of use: > http://www.postgresql.org/docs/8.1/interactive/ddl-inherit.html I'm not sure inheritance will help here or not. I need to aggregate all the sub tables and add a field whose value depends on

[GENERAL] What to index to speed up my UNION views?

2006-03-27 Thread Ashley Moran
x27; and cmod_code=1234". Failing that I will have to include a vehicle_type column in each of the underlying tables, but I want to avoid anything that complicates the import procedure (which is already very slow). I'd be very grateful for any advice Cheers Ashley Moran -