PHP, SQLite ile İstekli yükleme vs birçok sorgular

1 Cevap php

Ben bir n +1 sorgu sorunu olan bir uygulama var, ama ben hevesle verilerini yüklemek için bir yol uygulandığı zaman, ben kesinlikle hiçbir performans kazancı bulundu. Ben bir kimlik haritayı kullanmak yapmak, böylece nesneleri yalnızca bir kez oluşturulur.

Burada ~ 3000 nesnelerin bir kriter bulunuyor.

first query + first object creation: 0.00636100769043 sec.
memory usage: 190008 bytes

iterate through all objects (queries + objects creation): 1.98003697395 sec.
memory usage: 7717116 bytes

Ben hevesli yükleme kullandığınızda Ve burada biri.

query: 0.0881109237671 sec.
memory usage: 6948004 bytes

object creation: 1.91053009033 sec.
memory usage: 12650368 bytes

iterate through all objects: 1.96605396271 sec.
memory usage: 12686836 bytes

Yani benim sorular

  1. Küçük sorguları gelince SQLite sadece sihirli yıldırım hızlı mı? (MySQL ile çalışmaya alışkınım.)
  2. Bu sadece herkes yanlış görünüyor mu? Değil istekli yükleme çok daha iyi performans vermiş olması gerekir?

1 Cevap

Sizin "sorun" Part SQLite küçük sorguları hızlı yıldırım olduğunu!

The other symptom of the "problem" is because SQLITE is embedded code accessing a single local file there is none of the normal overhead of marshalling parameters, sending over the network, opening table space files, marshalling replies etc. that you get with a heavy database.