![]() Then I index the heck out of it but the single indexing of both columns did not show noticeable improvement. I'm using MySQL but is the MariaDB flavor that comes with XAMPP.Īfter searching with this TEXT column, I change it to CHAR(60) but to no avail. Of course creating the most efficient index for a given query greatly helps the query planner.įor MS SQL Server for example this doesn't matter Now consider a table of 52 million rows and you give SQL big credit for doing the job for you. In any case you can't starting ignoring cards until the selection/sort steps are done. Yes you partly can but then you must interleave the selection (where clause) and the sort, something very inefficient when coded. It's easy to see by oneself that you just can't start sorting the cards and ignoring a number of them until you're done selecting which one is allowed. You must extract cards in Hearts or Clubs, have at least one 'n' in their name, sort them by name in ascending order and value by descending order, ignoring the first 4 and outputing the next 6. , 7=7, 10=10), then Jack = 20, Queen = 30, King = 40, each multiplied by the coefficient of the card's colour.Ĭards have a name: 1.10 = ace, two, three. Say cards are valued like this: numbered cards = their face value (1=1. You're given a deck of 52 regular cards in random order.Ĭards fall in 4 colours: Spades, Hearts, Diamonds & Clubs.Įach color is associated to a multiplier: Clubs * 1, Diamonds * 2, Hearts * 3 and Spades * 4. You can see that by considering the following job to be done by hand (you're a processor now!): I doubt it since AutoIt is interpreted while any SQL engine is fine-tuned C-like compiled code.ĮDIT: BTW doing the sort at application level means doing exactly the same thing as how SQL works as I described in the post above. PS: added ADD INDEX `StudyDate_2` (`StudyDate`, `PatientBirthDate`) USING BTREE and searched by those two with not much speed change ( StudyDate and PatientBirthDate are integer ). Is there a way to query this in a way to have a faster result back ? tho, I find that any 2nd argument in the ORDER BY is just slow. So my observation is that "PatientName" takes a long time to sort, even tho "$rows = 20". due to "PatientName" been a text field, even as I did index it ![]() " ORDER BY StudyDate DESC, PatientName ASC limit $offset, $rows" // takes 300 ms. on the indexed int $sQuery = "select * from tblStudies ". " ORDER BY StudyDate DESC limit $offset, $rows" // takes 30 ms. " ORDER BY intUpdateTime DESC limit 1" $rs = mysqli_query ( $conn, $sQueryUpdateTime ) $row = mysqli_fetch_assoc ( $rs ) $sQueryUpdateTime = "select intUpdateTime from tblStudies ".
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |