6 comments

  • nathanfries1 hour ago
    Why can&#x27;t consecutive OR statements with common columns be reduced to IN? (I say consecutive since I assume ordering matters).<p>WHERE id = 1 OR id = 2... Should be abled to be reduced to WHERE id IN (1,2...)<p>However WHERE id = 1 OR name = &#x27;John&#x27; OR id = 2 Maybe can&#x27;t be reduced to WHERE id IN (1,2) OR name = &#x27;John&#x27;
    • moring1 hour ago
      Why does order of the OR operands matter?
      • nathanfries1 hour ago
        With a perfect optimizer and perfect knowledge of ordinality and statistics, I think performance would be the same. However in practice, I do not believe it always reorders predicates reliably for optimal performance.<p>My experience is that order does matter in MySQL and especially in DWH environments where the optimizer may not be aware of things like partitioning.
      • Riemer58 minutes ago
        OR short-circuiting, evaluation stops when one of the statements is true. So it might influence performance?
  • jodderayon1 hour ago
    [dead]
  • tigerfalcon761 day ago
    [dead]
  • galkk1 minute ago
    Damn. After working 1.5 years with MySQL, I wonder if there is anything good with that database server.<p>My favorite thing to hate though is still locking and non-locking reads in REPEATABLE READ. Even if it’s documented, it still doesn’t make it right.<p>&gt; It is not recommended to mix locking statements (UPDATE, INSERT, DELETE, or SELECT ... FOR ...) with non-locking SELECT statements in a single REPEATABLE READ transaction, because typically in such cases you want SERIALIZABLE. This is because a non-locking SELECT statement presents the state of the database from a read view which consists of transactions committed before the read view was created, and before the current transaction&#x27;s own writes, while the locking statements use the most recent state of the database to use locking. In general, these two different table states are inconsistent with each other and difficult to parse.
  • bot40329 minutes ago
    I&#x27;m not going to trust any performance and tuning analysis that repeatedly quotes and graphs the runtime as seconds when it&#x27;s measured in milliseconds.
  • Sigmazero601 day ago
    [dead]