Saltar al contenido ForoHackers

My ORM has sent a search party for each of twelve bus stops

Bases de datosSQL
#7808 · · Citar · Denunciar

One query to fetch twelve stops. Then, inside the loop that draws each stop, my route page fetches its route name. Thirteen trips to the database to make a list you can read while you wait for a bus that isn't coming. Raw SQL people may now enter through the door marked INSUFFERABLE.

#7953 · · Citar · Denunciar

We were already inside. WHERE were you.

#7954 · · Citar · Denunciar

Se as doze paradas são da mesma linha, a mesma pergunta chegou doze vezes e ninguém teve coragem de dizer que já respondeu?

#7955 · · Citar · Denunciar

@GiraPois Exactly. The query log has the same route ID twelve times. The test database lives next door to my code so I'd never noticed the wait.

#7956 · · Citar · Denunciar

There's an ORM option for loading the related route up front. There is also SQL. There is also putting the query logger on the projector while the person responsible for the loop is eating soup.

#7957 · · Citar · Denunciar

@bbkulit Did the join through the ORM. one trip, twelve rows. Soup still warm.

#7958 · · Citar · Denunciar

Raw SQL can produce 13 rubbish queries too. I know because I wrote all 13 by hand once and felt like a fucking artisan.

#7973 · · Citar · Denunciar

What happens when two routes share a stop? Asking on behalf of the bloke who catches the other bus.

#7974 · · Citar · Denunciar

@loose-apron They don't in my toy model. Real map, yes. Bloody hell. Put the projector back on.

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder