Re: Re: No descending index ?
One trick I have used in the past in other databases is to create your own descending index. If your field is say fieldA, when you enter a row into the table take the value of fieldA and subtract from 0, then put that in fieldB. Index fieldB and you now can order rows descending. - Steve Yates - Can't I have just a little bit of peril? ~ Taglines by Taglinator - www.srtware.com ~ sql,query - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: No descending index ?
Mpu Gondrong wrote: Selasa, 17/12/2002 7:38:52, Daniel menulis: DK> What's wrong with using: order by MyIndex DESC If I have 100 rows and mysql calculates with desc got 90 or more (>30%) rows, index won't be used. I have thousand rows, and just want to get the last row. Without index, this is horrible. Or Am I wrong ? Tertanda, Oguds [36856104] You can use max() to get the biggest Primary Key value, and then select the row with that primary key. Or you can use: select * from MyTable order by MyIndex DESC limit 1 -- Daniel Kasak IT Developer * NUS Consulting Group* Level 18, 168 Walker Street North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: www.nusconsulting.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: No descending index ?
On Tue, Dec 17, 2002 at 07:37:17AM +0700, Mpu Gondrong wrote: > Hello mysql, > > I am currently building news portal with php and mysql, and quite > surprised knowing mysql doesn't support descending index. Why ? I > think this feature is really needed. For example I want to show the > latest news (from last updates, not always everyday). With ascending > index, mysql doesn't use it. > > My current trick is crawling back (ie 1 month) and forward (if any in > that month), but this is really annoying. Any plan / trick for this ? > TIA. I'm not quite sure what you're after, but MySQL 4.0 has support for reading indexes in reverse order in some circumstances. This greatly speeds up some queries that were slow in 3.23. Jeremy -- Jeremy D. Zawodny | Perl, Web, MySQL, Linux Magazine, Yahoo! <[EMAIL PROTECTED]> | http://jeremy.zawodny.com/ MySQL 3.23.51: up 1 days, processed 66,924,046 queries (426/sec. avg) - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: No descending index ?
Mpu Gondrong wrote: Hello mysql, I am currently building news portal with php and mysql, and quite surprised knowing mysql doesn't support descending index. Why ? I think this feature is really needed. For example I want to show the latest news (from last updates, not always everyday). With ascending index, mysql doesn't use it. My current trick is crawling back (ie 1 month) and forward (if any in that month), but this is really annoying. Any plan / trick for this ? TIA. Tertanda, Oguds [36856104] ??? What's wrong with using: order by MyIndex DESC -- Daniel Kasak IT Developer * NUS Consulting Group* Level 18, 168 Walker Street North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: www.nusconsulting.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: No descending index ?
Hi, Can you just SELECT x, y, z FROM table WHERE ORDER BY timestamp_column DESC; ? -Dan On Tue, 17 Dec 2002, Mpu Gondrong wrote: > Hello mysql, > > I am currently building news portal with php and mysql, and quite > surprised knowing mysql doesn't support descending index. Why ? I > think this feature is really needed. For example I want to show the > latest news (from last updates, not always everyday). With ascending > index, mysql doesn't use it. > > My current trick is crawling back (ie 1 month) and forward (if any in > that month), but this is really annoying. Any plan / trick for this ? > TIA. > > Tertanda, > Oguds [36856104] > > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > -- Regards, Dan Goodes PlanetMirror Admin http://planetmirror.com/ [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php