Re: [GENERAL] Performance of outer joins?

2006-12-17 Thread macgillivary
ben would something like this work in your situation? SELECT customer.id, customer.name, deliveries.calendar_day, deliveries.delivered FROM ben_customers as customer, ben_deliveries as deliveries WHERE customer.id = deliveries.customers_id and deliveries.calendar_day in (Select day

Re: [GENERAL] speeding up big query lookup

2006-08-29 Thread macgillivary
Just for fun, another approach since I believe pg supports it: select whateverFields from object_val as outer where (outer.object_id, outer.object_val_type_id,outer.observation_date) IN (select inner.object_id, inner.object_val_type,max(inner.observation_date) from object_val as inner where i

Re: [GENERAL] speeding up big query lookup

2006-08-29 Thread macgillivary
I just finished reading 'The Art of SQL' by Stephane Faroult who has a chapter (ch 6) discussing this very topic. I strongly recommend any developer dealing with databases take a few days to read this narrative. A solution would seem to depend on whether you have many objects which change in meas

Re: [GENERAL] How do i store arbitrary questions and answers in SQL?

2006-08-29 Thread macgillivary
I agree that option 3 is the way to go. There is a little reading at: http://www.varlena.com/varlena/GeneralBits/110.php which may be of interest. Tim Allen wrote: > lifeisgood wrote: > > 3. Different answer tables each with answer types - same problem as 2 > > but even harder. > > This is the o

Re: [GENERAL] How do i store arbitrary questions and answers in SQL?

2006-08-26 Thread macgillivary
key linking to the qid. I had a completely different problem on my mind (testing user's knowledge). Sorry about that. macgillivary wrote: > I agree with Tim, that your option 3 is really not all that hard, and I > suggest would provide you with the best solution. I'm assuming,

Re: [GENERAL] How do i store arbitrary questions and answers in SQL?

2006-08-26 Thread macgillivary
I agree with Tim, that your option 3 is really not all that hard, and I suggest would provide you with the best solution. I'm assuming, however, that your application asks the question and checks the user supplied answer with the answer in the db (and not Jeopardy style). I might add a 'join' or

Re: [GENERAL] Massive slowdown when LIMIT applied

2006-08-22 Thread macgillivary
Purely out of curiosity, what sort of execution time do you get if you use: SELECT * FROM (SELECT username,acctstarttime FROM radacct WHERE username='user' ORDER BY acctstarttime ) allstarttimes LIMIT 50; Graeme Hinchliffe wrote: > > Now, if I do the following: > > SELECT username,acctstarttime

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

2006-08-14 Thread macgillivary
for an excellent book on keeping things where they should be go buy: "The ART of SQL" by Stephane Faroult. Sample chapter online. http://www.oreilly.com/catalog/artofsql/ It's an excellent read, and provides ample arguments for keeping constraint management with the database and not in each of th