Skip to content

Commit

Permalink
Added raw_sql benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
akaariai committed Sep 17, 2013
1 parent 746ef51 commit 94fc28d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
Empty file.
20 changes: 20 additions & 0 deletions djangobench/benchmarks/raw_sql/benchmark.py
@@ -0,0 +1,20 @@
from djangobench.utils import run_benchmark
from raw_sql.models import OneField
from django.db import connection

def benchmark():
cursor = connection.cursor()
cursor.execute("select field1 from raw_sql_onefield")
list(cursor.fetchall())

def setup():
for i in range(0, 10):
OneField(field1=i).save()

run_benchmark(
benchmark,
setup=setup,
meta={
'description': 'A test for stressing direct SQL performance',
}
)
4 changes: 4 additions & 0 deletions djangobench/benchmarks/raw_sql/models.py
@@ -0,0 +1,4 @@
from django.db import models

class OneField(models.Model):
field1 = models.CharField(max_length=100)
3 changes: 3 additions & 0 deletions djangobench/benchmarks/raw_sql/settings.py
@@ -0,0 +1,3 @@
from djangobench.base_settings import *

INSTALLED_APPS = ['raw_sql']

0 comments on commit 94fc28d

Please sign in to comment.