Does indexing a database involve automating querying?



  • My server has been getting slow periods due to high CPU spikes. Whenever this happens, I run "top" in command line and I see a MySQL process taking up over 300% CPU. So I inspect my MySQL slow log.

    Exactly every 15 minutes non stop, the largest table (item_orders) in my database with almost 1 million records is being queried. Is this caused from my server automatically indexing the table? There is nothing in my codebase that involves doing this.

    And if it's showing up in my slow log I'm guessing the table needs to be optimized better? Do Laravel attributes get taken into account when querying a table? I can see attributes that should be optimized better as they call other tables. But would a raw query directly in the database involve this?

    The exact query that shows is this: SELECT /*!40001 SQL_NO_CACHE */ * FROM item_orders;



  • This is the SELECT you usually see when performing a mysqldump

    I have written about this before

    • Aug 12, 2016 : https://dba.stackexchange.com/questions/120410/is-it-safe-to-run-parallel-innodb-single-transaction-dumps-of-individual-tables/146668#146668
    • Nov 24, 2016 : https://dba.stackexchange.com/questions/156120/select-data-which-is-bigger-than-buffer-pool-size/156304#156304
    • Jul 13, 2011 : https://dba.stackexchange.com/questions/3824/mysql-slow-query-log-select-n-sql-no-cache/3825#3825

    This means that someone or something is running a mysqldump backup. If your database instance has replication, the mysqldumps should be executed on the replica DB server rather than the primary DB server.

    If you must run mysqldumps on the one DB instance, do it during off-peak hours.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2