以下を機能させることができない理由がわかりません:
DB::table('twitter_hashtags')->paginate(5);
私が得るたびに(2番目の数字は異なる傾向があります)
Allowed memory size of 134217728 bytes exhausted (tried to allocate 95735352 bytes)
( 18776710 ) のように使用してみましたが、違いはありませんでした
DB::connection()->disableQueryLog();
削除->paginate(5)
しても違いはありません。
私がしようとすると:
DB::select('SELECT * FROM twitter_hashtags');
正常に動作しますが、ページネーション オプションでビルドを使用できません。
誰でも提案はありますか?
テーブル twitter_hashtags には、現在 5500 のレコードがあります。id、tweet_id、ハッシュタグは保存されるので、テーブルが大きすぎても問題ありません。
テーブルのサイズ:
Data 384,0 KB
Index 464,0 KB
Total 848,0 KB
アップデート
要求された追加情報として
これがアクションです
public function getHashtags()
{
DB::connection()->disableQueryLog(); // With or without does not make a difference
$retweets = DB::table('twitter_hashtags')->paginate(10);
// Show the page
return View::make('twitter/retweets', compact('retweets'));
}
ご覧のとおり、私はリツイートのビューを使用しています。問題はリツイート、またはこの方法でデータを取得しようとするほぼすべてのテーブルにも存在します。
景色'
</pre><? print_r($retweets) ?></pre>
テーブルの作成に使用した移行
public function up()
{
Schema::create('twitter_hashtags', function($table)
{
// Basic run information
$table->increments('id');
$table->string('status_id')->index();
$table->string('hashtag')->index();
// Misc.
$table->timestamps();
});
}
これらは、メモリ制限を 256M に引き上げたときの応答の最初の約 100 行です。
Illuminate\Database\Query\Builder Object
(
[connection:protected] => Illuminate\Database\MySqlConnection Object
(
[pdo:protected] => PDO Object
(
)
[queryGrammar:protected] => Illuminate\Database\Query\Grammars\MySqlGrammar Object
(
[wrapper:protected] => `%s`
[selectComponents:protected] => Array
(
[0] => aggregate
[1] => columns
[2] => from
[3] => joins
[4] => wheres
[5] => groups
[6] => havings
[7] => orders
[8] => limit
[9] => offset
[10] => unions
)
[tablePrefix:protected] =>
)
[schemaGrammar:protected] =>
[postProcessor:protected] => Illuminate\Database\Query\Processors\Processor Object
(
)
[events:protected] => Illuminate\Events\Dispatcher Object
(
[container:protected] => Illuminate\Foundation\Application Object
(
[booted:protected] => 1
[bootingCallbacks:protected] => Array
(
[0] => Closure Object
(
[parameter] => Array
(
[$app] =>
)
)
[1] => Closure Object
(
[static] => Array
(
[instance] => Illuminate\Log\LogServiceProvider Object
(
[defer:protected] => 1
[app:protected] => Illuminate\Foundation\Application Object
*RECURSION*
)
)
)
[2] => Closure Object
(
[static] => Array
(
[instance] => Illuminate\Mail\MailServiceProvider Object
(
[defer:protected] => 1
[app:protected] => Illuminate\Foundation\Application Object
*RECURSION*
)
)
)
[3] => Closure Object
(
[static] => Array
(
[instance] => Illuminate\Queue\QueueServiceProvider Object
(
[defer:protected] => 1
[app:protected] => Illuminate\Foundation\Application Object
*RECURSION*
)
)
)
[4] => Closure Object
(
[static] => Array
(
[instance] => Illuminate\Translation\TranslationServiceProvider Object
(
[defer:protected] => 1
[app:protected] => Illuminate\Foundation\Application Object
*RECURSION*
)
)
)
更新 2
要求どおり。これは応答です:
Array
(
[total] => 5689
[per_page] => 5
[current_page] => 1
[last_page] => 1138
[from] => 1
[to] => 5
[data] => Array
(
[0] => stdClass Object
(
[id] => 1
[status_id] => 384992474579484672
[hashtag] => Twenterand
[created_at] => 2013-10-01 11:00:02
[updated_at] => 2013-10-01 11:00:02
)
[1] => stdClass Object
(
[id] => 2
[status_id] => 384992323190280192
[hashtag] => Twenterand
[created_at] => 2013-10-01 11:00:03
[updated_at] => 2013-10-01 11:00:03
)
[2] => stdClass Object
(
[id] => 3
[status_id] => 384989174014545921
[hashtag] => PVDA
[created_at] => 2013-10-01 11:00:03
[updated_at] => 2013-10-01 11:00:03
)
[3] => stdClass Object
(
[id] => 4
[status_id] => 384988499188801536
[hashtag] => GR2014
[created_at] => 2013-10-01 11:00:03
[updated_at] => 2013-10-01 11:00:03
)
[4] => stdClass Object
(
[id] => 5
[status_id] => 384986184092356608
[hashtag] => GR2014
[created_at] => 2013-10-01 11:00:03
[updated_at] => 2013-10-01 11:00:03
)
)
)
)
)
アップデート 3
ここで getStatuses に使用するコード
public function getStatuses()
{
// Get all the paginated statuses
$statuses = DB::table('twitter_statuses')
->select('status_id', 'text', 'user_screen_name','datetime','place')
->orderBy('datetime', 'DESC')
->paginate(10);
// Show the page
return View::make('twitter/statuses', compact('statuses'));
}
そして完全なビューファイル
@extends('layouts/default')
{{-- Page title --}}
@section('title')
Twitter Statuses ::
@parent
@stop
{{-- Page content --}}
@section('content')
<h1>Twitter Statuses</h1>
<div class="container">
<table class="table">
<tr>
<th>Datum</th>
<th>Gebruiker</th>
<th>Tweet</th>
<th>Locatie</th>
</tr>
<?php foreach ($statuses as $status): ?>
<tr>
<td>{{ $status->datetime; }}</td>
<td><?php echo $status->user_screen_name; ?></td>
<td><?php echo $status->text; ?></td>
<td><?php echo $status->place; ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php echo $statuses->links(); ?>
</div>
@stop