[SQL] techniques for manual ordering of data ?

2004-02-07 Thread Peter Galbavy
I tried googling, but the keywords here are so general, that I couldn't find much useful. I am looking for reommendations on how to build an ordered list of media (in this case photographs) in a particular "context". What I have - which I have somewhat simplified maually - is: CREATE TABLE contex

Re: [SQL] weighting (the results of) a query ?

2003-01-07 Thread Peter Galbavy
> I think your query might fail on that requirement regardless, no? At > least I missed how you'd prevent it. I have had about 10 minutes to play with this - my day jobrequires I do real testing when I get home later tonight :) Thanks, and I will keep an eye out for this and figure a way around

Re: [SQL] weighting (the results of) a query ?

2003-01-07 Thread Peter Galbavy
> Most likely you should write UNION ALL, not UNION. As given, the query > will go through a pass of attempted duplicate-row-elimination, which is > almost certainly not what you want. Not sure - what I want is only one row per real row but ordered as per the constants. When you say duplicate-row

Re: [SQL] weighting (the results of) a query ?

2003-01-07 Thread Peter Galbavy
ade it work OK. Not sure yet on real world performance, but that's what tuning is for :) Hope someone finds this in the archive and finds it useful. Peter - Original Message - From: "Peter Galbavy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, January

[SQL] weighting (the results of) a query ?

2003-01-05 Thread Peter Galbavy
I have a table with a primary key ('md5') and a bunch of text fields. There is one row per 'photograph' and the number of rows is about 1100 now but will rise to over 20,000 in a few months - assuming I get time to import all my stuff. I would like to offer users on my web site a free text search

Re: [SQL] Need help paging through record sets

2002-12-21 Thread Peter Galbavy
I have an almost identical application, but I am using Apache::ASP instead of PHP. Apart from the language differences, I suspect the ideas are the same. What I have done is store the *entire* list of results in a session variable with a clock-time. When I get a new query (...?page=2), I check i

Re: [SQL] help optimise this ?

2002-11-21 Thread Peter Galbavy
Wow. Three people have replied with an effectively identical solution. Why didn't I think of this ? Answers on a postcard to... Thanks to all that have replied. Peter - Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> To: "Peter Galbavy" <[EMAIL

[SQL] help optimise this ?

2002-11-21 Thread Peter Galbavy
I have a table of image 'instances' where the columns include: md5 char(32),-- the 'original' image md5 key file_md5 char(32) primary key, -- the md5 of each version of an image image_width int, image_length int I want to then find either the largest (max) or smallest (min)

Re: [SQL] 'fake' join and performance ?

2002-10-22 Thread Peter Galbavy
> That would be in violation of the SQL spec. The query is defined to > return each join row from the cross product of the FROM tables that > meets the condition of the WHERE clause. As you wrote the query, each > metadata row that meets the WHERE clause will be returned exactly as > many times a

[SQL] 'fake' join and performance ?

2002-10-22 Thread Peter Galbavy
OK, I am now confused; postgresql 7.3beta2 on OpenBSD: photos=# select * from metadata WHERE name = 'Make' and value = 'Canon' limit 10; *bang*, 10 values, sub second response. photos=# select * from metadata m, images i WHERE m.name = 'Make' and m.value = 'Canon' limit 10; *yawn* - see you la

Re: [SQL] IGNORE ME how do i insert an empty string ?

2002-10-15 Thread Peter Galbavy
Please ignore me for now. The string is NOT empty, but full of NUL characters. My bad for not using 'less' to view the output... Peter - Original Message ----- From: "Peter Galbavy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 15, 2002

Re: [SQL] how do i insert an empty string ?

2002-10-15 Thread Peter Galbavy
Sorry: 7.3 beta 2 on OpenBSD 3.2 Peter - Original Message - From: "Peter Galbavy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 15, 2002 11:01 AM Subject: [SQL] how do i insert an empty string ? > FAQ: A search yielded nothing explici

[SQL] how do i insert an empty string ?

2002-10-15 Thread Peter Galbavy
FAQ: A search yielded nothing explicit... I have an INSERT statement: INSERT INTO metadata (md5, origin, name, value) VALUES ('fd859f263bd0579935f2146a22d24f32', 'EXIF', 'UserComment', '') but this fails (using Perl DBI, DBD::Pg) because $dbh->quote() returns two single quotes, wh

Re: [SQL] performance of functions - or rather lack of it

2001-04-05 Thread Peter Galbavy
ion just for the completeness of it. > Unless your TCP connection is running across tin cans and string, > the transfer time for the query text is negligible ... Fair point. I am not really in the 100Mb networking work in my heart ... :-) -- Peter Galbavy Knowledge M

Re: [SQL] performance of functions - or rather lack of it

2001-04-04 Thread Peter Galbavy
BTW The service is 7.0.2 and the client 7.1RC1 and the OSes are OpenBSD/i386 2.8-stable. On Wed, Apr 04, 2001 at 11:12:34AM +0100, Peter Galbavy wrote: > We are building a postgresql based backend database for our 'hosting > provisioning' system. In a vain attempt to add some

[SQL] performance of functions - or rather lack of it

2001-04-04 Thread Peter Galbavy
SQL across the wire 1000 times would have saved some time even without any potential query optimisations by pre-parsing the SQL ? rgds, -- Peter Galbavy Knowledge Matters Ltd. http://www.knowledge.com/ ---(end of broadcast)--- TIP 5: Have you ch